Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

What causes 'Invalid Roi' Error Message when using imaqCompareGoldenTemplate

When Using the imaqCompareGoldenTemplate functionwithin CVI I sometimes get the message Invalid Roi.

 

I am currently using the function in a loop that tests several images. Several images test and give correct outputs (I am outputting aspects such as scores and positions to screen) however one image in particular gives me this error.

 

I have recieved this error in the past but have managed to solve it by using a convolution filter to highlight the image details.

 

Thanks for your help in advance!!

0 Kudos
Message 1 of 7
(4,344 Views)
Are you using any imaq extract? If so have defined the image destination uniquely? Can you post your code?
0 Kudos
Message 2 of 7
(4,321 Views)

Hi,

 

Thanks for your response.

 

I am not currently using an imaqExtract . I use imaqCast to ensure the image is of the correct format. I have used imaqExtract in the past to extract the Luminance plane from the image but the same error was occurring.

 

What do you mean by defining the image uniquely?

 

I have now solved the issue by setting the registrationMethod in the InspectionOptions to none where as previously I had Perspective. I believe this was causing a problem as the image had already been rectified for perspective distortion. I am still a little unsure of this though.

 

Basically at present I capture my image calibrate it using some edge  Tools and rectify the image for perspective distortion and rotation of the unit. 

0 Kudos
Message 3 of 7
(4,318 Views)
I meant defining unique buffer names
0 Kudos
Message 4 of 7
(4,315 Views)

The images being compare are both defined uniquely. The destination images for bright and dark defects is actually the same image.

 

I should also not that the function that includes imaqGoldenTemplate is run many times on many different images but does not always cause the InvalidRoi error. Again my thinking is that the perspective change may be the cause as it is different in different parts of the image? I am not entirely sure but would like to understand the cause if you understand it.

 

My apologies for not posting the code but I am unable to at present. If you still think it would be of benifit then I will try and arrange it.

0 Kudos
Message 5 of 7
(4,313 Views)

Hey Warren,

 

Are all the images the same size? 

 

Kind regards,

Dominic Walker
Cardiff University
Electrical and Electronic Engineering Student
0 Kudos
Message 6 of 7
(4,283 Views)
No, images are not of the same size and the Golden template fits inside the inspection image. It is also not set to go outside of the inspection image
0 Kudos
Message 7 of 7
(4,281 Views)