Wie man die Windungen einer Spirale erkennt und zählt

Ich muss eine spiralförmige Feder erkennen und ihre Windungen zählen.

Ich habe folgendes versucht:

Image<Bgr, Byte> ProcessImage(Image<Bgr, Byte> img)
{ 
    Image<Bgr, Byte> imgClone = new Image<Bgr,byte>( img.Width, img.Height);
    imgClone = img.Clone();
    Bgr bgrRed = new Bgr(System.Drawing.Color.Red);


    #region Algorithm 1


    imgClone.PyrUp();
    imgClone.PyrDown();
    imgClone.PyrUp();
    imgClone.PyrDown();
    imgClone.PyrUp();
    imgClone.PyrDown();

    imgClone._EqualizeHist();
    imgClone._Dilate(20);
    imgClone._EqualizeHist();
    imgClone._Erode(10);

    imgClone.PyrUp();
    imgClone.PyrDown();
    imgClone.PyrUp();
    imgClone.PyrDown();
    imgClone.PyrUp();
    imgClone.PyrDown();

    imgClone._EqualizeHist();
    imgClone._Dilate(20);
    imgClone._EqualizeHist();
    imgClone._Erode(10);


    Image<Gray, Byte> imgCloneGray = new Image<Gray, byte>(imgClone.Width, imgClone.Height);

    CvInvoke.cvCvtColor(imgClone, imgCloneGray, Emgu.CV.CvEnum.COLOR_CONVERSION.CV_BGR2GRAY);

    imgCloneGray = imgCloneGray.Canny(c_thresh, c_threshLink);//, (int)c_threshSize);

    Contour<System.Drawing.Point> pts = imgCloneGray.FindContours(Emgu.CV.CvEnum.CHAIN_APPROX_METHOD.CV_CHAIN_APPROX_SIMPLE, Emgu.CV.CvEnum.RETR_TYPE.CV_RETR_EXTERNAL);

    CvInvoke.cvCvtColor(imgCloneGray, imgCloneYcc, Emgu.CV.CvEnum.COLOR_CONVERSION.CV_GRAY2BGR);

    if (null != pts)
    {
        imgClone.Draw(pts, bgrRed, 2);
        imgClone.Draw(pts.BoundingRectangle, bgrRed, 2);
    }

    #endregion 

    return imgClone; 
}

Ich bin einigermaßen in der Lage, den Frühling zu bekommen, aber wie man die Zählungen bekommt. Ich suche nach Algorithmen. Ich suche momentan keine Geschwindigkeitsoptimierung.

Dies ist ähnlich wie das Zählen der Finger. Die Federspirale ist sehr dünn, um eine Kontur zu erhalten. Was kann man noch tun?http://www.luna-arts.de/others/misc/HandsNew.zip

Antworten auf die Frage(1)

Ihre Antwort auf die Frage