Example Code

Create Vision Template from an Image in LabVIEW

Code and Documents

Attachment

Overview

This VI creates a Vision Template programmatically in LabVIEW from a selected image file. This example can be useful because the template file that is created can be used in Vision Assistant.

Description

Once the desired image is loaded into LabVIEW, the user defines a ROI on the image for which the template file will be created from. The ROI template is then extracted and saved as a PNG file with the Vision Pattern Information included with it. The Vision Assistant Express VI is then used to look for matches of the newly created template in the UUT image.

Steps to Implement or Execute Code

  1. Set the destination path for the template to be created
  2. Specify the path to the image from which the template will be extracted from
  3. Specify the path of the UUT image
  4. Run the VI once to load the image
  5. Select the desired Region of Interest (ROI) on the "UUT Image" indicator
  6. Run the VI again

Requirements

Software

LabVIEW 8.6 or later

IMAQ (part of Vision Acquisition Software) - Compatibility Link

Vision Development Module - Compatibility Link

Additional Images or Video

Template.jpg

**This document has been updated to meet the current required format for the NI Code Exchange. For more details visit this discussion thread**

Salvador Mikel
National Instruments
Ingeniería de Aplicaciones
www.ni.com/soporte

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
MarkBalla-Tecnova
Member
Member
on

This vi is saved in version 8.6 and not 8.5 as stated

shadowsboy
Member
Member
on

muy buen aporte gracias

phenominafree
Member
Member
on

what is the uut image?

Rick_J.
Member
Member
on

We are unable to make this work as is.

We get error -1074396077 "incompatible file type" from "IMAQ Learn pattern 2.vi".

Do you have any suggestions?

omarbedair
Member
Member
on

Same here...

Have you found the source of error ?

Thanks

meraj0525
Member
Member
on

what file formats of image will this vi program above supports. when i loaded a jpg image an converted png to jpg in the IMQ WRITE FILE it is not supporting the image. displays cannot read.

neil_lan@hotmail.com
Member
Member
on

error.jpg

neil_lan@hotmail.com
Member
Member
on

what migt be wrong with my JPEG files?

DanMad
Member
Member
on

Hi,

The vi is a bit outdated. I fixed it (no more error) removing the type input from the "IMAQ create" and updating the vi using this example:

LabView\examples\Pattern Matching\Pattern Matching (All).vi

It is a default labview example but it works well and it is helpful to understand how the pattern matching works.

 

Hope it helps,

Cheers

Contributors