CvException in FindCornerSubPix

Ask questions on using Emgu CV with C++
Post Reply
hakim83
Posts: 1
Joined: Fri Aug 27, 2010 7:10 pm

CvException in FindCornerSubPix

Post by hakim83 » Fri Aug 27, 2010 7:30 pm

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.

canming
Site Admin
Posts: 1036
Joined: Thu Feb 28, 2008 4:16 pm

Re: CvException in FindCornerSubPix

Post by canming » Mon Oct 04, 2010 7:55 am

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

flyrcdream
Posts: 3
Joined: Tue Jul 03, 2012 11:14 pm

Re: CvException in FindCornerSubPix

Post by flyrcdream » Wed Jul 04, 2012 1:07 am

I appreciate any help of explaining why this happen or what is size limit would be.

Chris_Johnson
Posts: 573
Joined: Tue Sep 20, 2011 3:29 pm

Re: CvException in FindCornerSubPix

Post by Chris_Johnson » Thu Nov 22, 2012 6:25 pm

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

Hope59
Posts: 1
Joined: Tue Feb 04, 2014 5:18 am

Re: CvException in FindCornerSubPix

Post by Hope59 » Tue Feb 04, 2014 5:22 am

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.

Post Reply