CVB 13.00.003 Shapefinder2 does not allow me to create a classifier if AOI of feature window is selected in the corners of an image


When using the C# CSShapeFinder2010 project (for testing purposes), it does not return a shapefinder object if the AOI for the feature window is selected in one of the corners… I only modified the RectDragged function for testing and used one of the sample pictures in CVB (e.g., ClassicSwitch).

private void cvDisp_RectDraged(object sender, EventArgs e)
      double x0, y0, x1, y1, x2, y2;
      x0 = x1 = x2 = y0 = y1 = y2 = 0.0;
      // get the selected AOI
      cvDisp.GetSelectedArea (ref x0, ref y0, ref x1, ref y1, ref x2, ref y2);
      // keep it in the AOI
      m_AOI = new Rectangle((int)x0, (int)y0, (int)(x2 - x0) + 1, (int)(y1 - y0) + 1);     

If the function m_AOI = new Rectangle … is replaced with one of the following (for testing):

m_AOI = new Rectangle(Cvb.Image.ImageWidth(cvImg.Image) - 100, 0, 99, 100);
m_AOI = new Rectangle(0, 0, 100, 100);

and then Train is clicked the returned ShapeFinder object will be 0.

Is this behaviour expected? If yes, how far does the training window need to be away of the edges/corners of the images. It works fine if a AOI is chosen in the centre.

Thanks for your help.


I think I just fixed my own problem.

When calling CreateSF2, it returned always 0. As my test-images are really dark and I used one of the default values I have seen in one of the demo-apps I didn’t think of anything else…

Basically the threshold (“Minimal image contrast required for features.”) was to high! Yeah :slight_smile: fixed… till the next time :smiley:


Hi @Amicelli

I was just about to reply. What you have to keep in mind as well is that ShapeFinder2 should actually be able to find enough features to generate a model from - otherwise null is CreateSF2's was of saying “it did not work”…

Especially the “ClassicSwitch” images are problematic with your 100x100 pixels AOI if you place the AOI in one of the corners:
image image
no matter which corner you choose - you’ll hardly find any features other than noise, so model generation from these AOIs is not leading anywhere.