Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

here's some (very sloppy, sorry for that) attempt, let's just try some template matching:

image description

Mat m = imread("im/6JULySd.png",0);
//Rect r(37,18,37,61);
//yea, i'm cheating, that's the 2nd '1', it did not work so easily with the 1st ;)
Rect r(182,19,42,63); 
Mat templ(m,r);

Ptr<GeneralizedHough> gh = createGeneralizedHoughBallard();
//Ptr<GeneralizedHough> gh = createGeneralizedHoughGuil();
gh->setTemplate(templ);
Mat_<Vec4f> pos; //an array of (x,y,1,0) tuples
gh->detect(m,pos);
cerr << pos << endl;
for (int i=0; i<pos.total(); i++)
{
    Vec4f p = pos.at<Vec4f>(i);
    circle(m,Point(p[0],p[1]),r.height/2,Scalar(255),2);
}

image description

here's some (very sloppy, sorry for that) attempt, let's just try some template matching:

image description

Mat m = imread("im/6JULySd.png",0);
//Rect r(37,18,37,61);
//yea, i'm cheating, that's the 2nd '1', it did not work so easily with the 1st ;)
Rect r(182,19,42,63); 
Mat templ(m,r);

Ptr<GeneralizedHough> gh = createGeneralizedHoughBallard();
//Ptr<GeneralizedHough> gh = createGeneralizedHoughGuil();
gh->setTemplate(templ);
Mat_<Vec4f> pos; //an array of (x,y,1,0) tuples
gh->detect(m,pos);
cerr << pos << endl;
for (int i=0; i<pos.total(); i++)
{
    Vec4f p = pos.at<Vec4f>(i);
    circle(m,Point(p[0],p[1]),r.height/2,Scalar(255),2);
}

image description

(well, again, this example is a cheat from the 1st line to the last. in real life, you'd have to improve a lot of params, like angles, distances, cannyThresholds and what not. feel free, to improve, and come back !)

here's some (very sloppy, sorry for that) attempt, let's just try some template matching:

image description

Mat m = imread("im/6JULySd.png",0);
//Rect r(37,18,37,61);
//yea, i'm cheating, that's the 2nd '1', it did not work so easily with the 1st ;)
Rect r(182,19,42,63); 
Mat templ(m,r);

Ptr<GeneralizedHough> gh = createGeneralizedHoughBallard();
//Ptr<GeneralizedHough> gh = createGeneralizedHoughGuil();
gh->setTemplate(templ);
Mat_<Vec4f> pos; //an array of (x,y,1,0) tuples
gh->detect(m,pos);
cerr << pos << endl;
for (int i=0; i<pos.total(); i++)
{
    Vec4f p = pos.at<Vec4f>(i);
    circle(m,Point(p[0],p[1]),r.height/2,Scalar(255),2);
}


[59, 50, 1, 0, 203, 50, 1, 0]

image description

(well, again, this example is a cheat from the 1st line to the last. in real life, you'd have to improve a lot of params, like angles, distances, cannyThresholds and what not. feel free, to improve, and come back !)