Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Pattern Match and Align?

Hi,

 

I am trying to align some images before subtracting one from the other to get the difference.

I have been using the geometric pattern match VIs to find a reference feature and return the displacement values.

My current solution seems to be working ok when things have just been shifted up or down, but when rotation is introduced things don't work as well.

 

Has anyone come across this problem before? A colleague of mine has been working with Cognex libraries and apparently they have a nice little feature that sorts all this out for you. I assume this is a standard image processing toolkit feature, but cant seem to find an equivelant in LabView.

 

See attached VIs for a better idea of what I am trying to do.

 

Thanks.

0 Kudos
Message 1 of 4
(4,220 Views)

OK, for the record, I have used NI and Cognex (vision Pro and InSight).  Cognex has the BEST pattern matching algorithms by far.  The results are always right if the score is above 700, and almost always right for scores down to like 400.  They are so good, that you always use them in a cognex app.  However, they become a crutch and the rest of the library is weaker; the vision pro edge tool is a nightmare to get results from... but I digress.  So, in the NI tools, you will get better results if you use the grayscale pattern match over the geometric pattern match.  Oh, and there is one really important thing, the Match Mode must be set to Rotation Invariant (1).  Below is the example image grey matched.  These were done in VBAI, but in LabView you use IMAQ Find Pattern.

pat003.jpgpat001.jpgpat002.jpg

 

0 Kudos
Message 2 of 4
(4,206 Views)

Thanks for the reply Icady, but that isn't really what I was asking.

 

The pattern matching isnt the problem, its aligning the two images.

Hopefully this diagram should explain a bit better:

 

 

 

[After having a look at other tools after creating this thread, I think the gold standard tool might be what I am looking for. It will still be good to hear what people think though]

0 Kudos
Message 3 of 4
(4,201 Views)

Oh.  I was off the mark there. 

 

Are the errors at the edges of the objects? If yes, that's because the pixels are square, and adding rotation will cause a slight change in the object.

 

Try fixing the problem in two iterations.

Run the pattern match, but just to get the angle.  Use the angle to rotate the image.

Run the pattern match on the rotated image to get the location.  Then do the subtraction from this result on the rotated image.

 

I know it's extra overhead, and it isn't right, but i'm pretty sure the subtracted results will be better.

 

One other thought, if you are subtracting images from a camera that has lens distortion, you will get funky edge results too.

 

 

0 Kudos
Message 4 of 4
(4,187 Views)