Page 1 of 1

CvException in FindCornerSubPix

Posted: Fri Aug 27, 2010 7:30 pm
by hakim83
Hi,
I'm trying to implement simple tracker using the optical flow, the feature points are calculated in rectangle selected by mouse:

Code: Select all

...
Emgu::CV::Image<Gray,Byte>^ imGr= im->Convert<Gray,Byte>();
imGr->ROI= tRect;
tCorners= imGr->GoodFeaturesToTrack(MAX_COUNT,0.01,5,3);
imGr->FindCornerSubPix(tCorners,System::Drawing::Size(10,10),System::Drawing::Size(-1,-1),MCvTermCriteria(20,0.03));
...
the program throw an Unhandled CvException when calling "FindCornerSubPix" (CvErrorHandler()s in CvInvokeCxcore.c), this happen when the size of selected template is small (21x21 can raise it).
I appreciate any help of explaining why this happen or what is size limit would be.

Re: CvException in FindCornerSubPix

Posted: Mon Oct 04, 2010 7:55 am
by canming
The following code in C# works for me:

Code: Select all

      [Test]
      public void TestGoodFeature()
      {
         using (Image<Bgr, Byte> img = new Image<Bgr, Byte>("stuff.jpg"))
         {
            PointF[][] pts = img.GoodFeaturesToTrack(100, 0.1, 10, 5);
            img.FindCornerSubPix(pts, new Size(21, 21), new Size(-1, -1), new MCvTermCriteria(20, 0.0001));

            foreach (PointF p in pts[0])
               img.Draw(new CircleF(p, 3.0f), new Bgr(255, 0, 0), 1);
         }
      }
If you cannot get it to work, try not to set a ROI. I am not sure FindCornerSubPix works with ROI or not.

Canming

Re: CvException in FindCornerSubPix

Posted: Wed Jul 04, 2012 1:07 am
by flyrcdream
I appreciate any help of explaining why this happen or what is size limit would be.

Re: CvException in FindCornerSubPix

Posted: Thu Nov 22, 2012 6:25 pm
by Chris_Johnson
Hi,

The FindCornerSubPix() method calls the opencv method cvFindCornerSubPix() you can find details about the parameters here. While I can't tell you limits hopefully this documentation will spread some light on the boundaries can be calculated.

http://opencv.willowgarage.com/document ... #index-147

Cheers,
Chirs

Re: CvException in FindCornerSubPix

Posted: Tue Feb 04, 2014 5:22 am
by Hope59
These types of information can be published and translated into many languages to allow distribution of information around...
I like your work for providing information to the other.