Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Overlaying golden template results on inspection image

I am setting up an inspection VI using Golden Templates. The inspection works fine however I do not know how to overlay the results from the Golden Template inspection (i.e. dark/bright defects) onto the original inspection image. Does anyone have a suggestion? Thanks in advance for your help.
0 Kudos
Message 1 of 5
(3,902 Views)
Hi there,
 
Are you using LabVIEW?  If so then try looking for the example code "Golern Template Inspection Example.vi"
(if you go to help>>find examples>>search tab at the top right>>search for templeates and double click this in the left list>>Select the vi mentioned above.
 
The overlay is achieved in this vi by creating a custom colour palette.
 
Hope this helps
 
Adam

Message Edited by AdamB on 01-08-2007 03:20 AM

Applications Engineering Team Leader | National Instruments | UK & Ireland
Message 2 of 5
(3,895 Views)
Thanks for the reply message.  I looked at the example and I'm still not quite clear on how to do this.  The defect output image from the Golden Template VI already has the color palette defined.  I was thinking that all I would need to do is perform an overlay operation.  Attached is a quick mock-up of the inspection VI I put together along with a sample golden template image and inspection images. 
0 Kudos
Message 3 of 5
(3,888 Views)
Hello JHess!

The IMAQ Compare Golden Template VI replaces the image that is wired into the Dark/Bright Defects Image input with a binary image whose pixels each have 3 possible values.  If no defect is present it is set to 0 (Black), if dark defects are found the pixel value is set to 1 (red in binary images), and if bright defects are found then the pixel value is set to 2 (Green in binary images).  So a new image is created that has pixel values of 0, 1, or 2 (black, red, or green).  The golden template example uses a custom color pallete and IMAQ comparison functions to change the pixel values in the inspection image where defects occur.  They use the IMAQ Compare MAX with a constant of 3 to set all values in the inspection image below 3 to a value of 3.  Then they replaced all of the 0 values in the defects image with 255 so they could then perform an IMAQ compare MIN using the defects image and the inspection image.  This function replaces all of the pixels in the inspection image with the defects image pixels that have pixel values of 1 and 2.  So now you have the original image with replaced pixel values of 1 and 2 where defects occurred.  The last thing they do is create a custom color pallete that leaves all pixel values in the inspection image the same except for values of 1 and 2 that get changed to the equivalent RGB values for green and red.  You would need to do a similar thing when you use the IMAQ Compare Golden Template VI because of the nature of the output.  In the code you posted you are on the right track but one thing I noticed is that you need to have another IMAQ Create for the Bright/Dark Defects Image Input into the IMAQ Compare Golden Template VI.  It takes a bit more coding to put the defects back into the original picture because a simple overlay will not work.  I hope this information helps.  Let me know if anything is unclear.  Thanks and have a great day.

Regards,
Mark T
Applications Engineer
National Instruments

Message 4 of 5
(3,863 Views)
Thanks for the clarification.  I updated the VI and things work great!
0 Kudos
Message 5 of 5
(3,805 Views)