05-01-2009 08:22 PM
I have the following code in my program:
axCWIMAQVision1.ReadImage(axCWIMAQViewer1.Image, @bmpfile1, axCWIMAQViewer1.Palette);
double zoom = -Math.Sqrt(axCWIMAQViewer1.Image.Width / axCWIMAQViewer1.Width);
axCWIMAQViewer1.ZoomScale = Math.Floor(zoom);
axCWIMAQViewer1.Regions.RemoveAll();
CWIMAQImage template = new CWIMAQImage();
axCWIMAQVision1.ReadImageAndVisionInfo(template, @bmpfile2, axCWIMAQViewer1.Palette);
CWMVCoordinateTransformation CoordinateTransformation = new CWMVCoordinateTransformation();
axCWMachineVision1.FindCoordTransformUsingPattern(axCWIMAQViewer1.Image, template, true, CoordinateTransformation, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
When it gets to the last line, I get this error:
"COMException was unhandled -- The coordinate system could not be found on this image"
What does this mean? I don't know how to fix this.
05-04-2009 03:44 PM
Hey dstanisl,
Did you get this little bit of code from an example code or is it a subset of something you wrote? Is there any more information the error message that could be helpful? What values are you passing to the FindCoordTransformUsingPattern function through the variable 'Missing. Value' ? It could be possible that one of the values you are using to define your coordinate system is invalid and causing an error.
Perhaps posting a larger porting of your code or more information on the error (if available) would be helpful in finding out what is going on.
Hope this helps!
-Ben
05-05-2009 01:13 PM
Actually I found out what the problem was. Here are the repaired code lines:
CWMVFindCTUsingPatternOptions CTOptions = new CWMVFindCTUsingPatternOptions();
CTOptions.MatchMode = CWIMAQMatchModes.cwimaqMatchRotationInvariant;
CTOptions.MinimumMatchScore = 600;
CTOptions.SubPixelAccuracy = true;
axCWMachineVision1.FindCoordTransformUsingPattern(axCWIMAQViewer1.Image, template, true, CoordinateTransformation, System.Type.Missing, CTOptions, System.Type.Missing, System.Type.Missing);
I made the assumption that the optional "CTOptions" argument was unnecessary. When I added the proper options, the error went away.