Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Golden Template comparison results

I am using CVI to compare an image to a golden template.  The function (imaqCompareGoldenTemplage()) returns an image that is all black (no defects).  How can I determine programmatically if the results passed or failed? 
 
Jon K.
  
0 Kudos
Message 1 of 2
(3,072 Views)
Jon,
 
A possible solution would be to run an "imaqLightMeterRect()" on the same rectangle as the golden template. This returns a "HistogramReport". It can tell you if there are any non-black pixels in the region. You can also use it to perform more complex analysis.
 
Here's a snippet from my solution:
 
//Setting up inputs
 InspectionAlignment location;
 InspectionOptions inspectionOptions;
 .
 .  
 inspectionOptions.binary = 1;                         //Displays the defects in binary in the target image
 
//Call the function
 VisionErrChk(imaqCompareGoldenTemplate(image, goldenTemplate, image, image,
                                               &location, &inspectionOptions));
 
//Display target image
 imaqSetWindowPalette(0, IMAQ_PALETTE_BINARY, NULL, 0); //Need to set palette type to binary 
 .
 .
//Analyze results
 RotatedRect searchRect;
 HistogramReport* report;
 
 searchRect = imaqMakeRotatedRect (80, 310, 60, 60, 0); //Same rectangle as the golden template
 report = imaqLightMeterRect(image, searchRect, TRUE, NULL) ;

Hope that helps,

Jaidev Amrite

Applications Engineer

National Instruments

 

 

0 Kudos
Message 2 of 2
(3,019 Views)