Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Create Reference Coordinate System

Solved!
Go to solution

?Need help dynamically creating a reference coordinate system.  Using Vision Assistant these base constant reference locations are automatically created. I can't find any real documentation of code examples on how to do this dynamically.  See attached image and ZIP file for details.  Thanks in advance!

 

Label08.png should be perfect match

Label10.png will show defects

 

 

Base locations generated by Vision Assistant

Base Constant Locations

 

Matt Fitzsimons
NI Alliance Member
LabVIEW Champion
NI Certified LabVIEW Architect
LabVIEW, LV-RT, Vision, DAQ, Motion, and FPGA
0 Kudos
Message 1 of 5
(5,949 Views)

To obtain your reference points, you need to first perform a couplle of edge detect functions on X and Y, and then calculate the intersection of the two lines.  Vision Asistant has these functions built in as well.  The results of those functions are then available forward of the point in the script where they are executed.

Machine Vision, Robotics, Embedded Systems, Surveillance

www.movimed.com - Custom Imaging Solutions
Message 2 of 5
(5,930 Views)

I appreciate your response but still unclear on how to create the reference coordinate system locations.  Should I use edge detection to determine the center point of the entire label or the center point of where the pattern match template aligns to the label under inspection?  How do these locations relate to aligning the Golden Template? What is the difference between the Update Coordinate System and the Get Coordinate System locations?   Answer what you can and appreciate any help!

Matt Fitzsimons
NI Alliance Member
LabVIEW Champion
NI Certified LabVIEW Architect
LabVIEW, LV-RT, Vision, DAQ, Motion, and FPGA
0 Kudos
Message 3 of 5
(5,913 Views)

Hi Matt,

 

This is a little complex, but I'll try to explain it the best I can:

 

When the coordinate system manager VI is called with the Updated Coordinate System function, the hardcoded reference system coordinates and angle are the coordinates and angle of the point and angle you selected when you *first* inserted, or modified the Set Coordinate System step in Vision Assistant. They are the points coming from a previous pattern matching or edge detection results that you selected in the coordinate system step. (Seems like you use pattern matching in your case).

On subsequent runs of the VI, as you can see, we are passing the name and results indices of that pattern matching step to get the results computed with the current image. These new results are used to update the "Measurement System" of the coordinate system structure, giving use the data we need to reposition subsequent ROIs.

 

When we need to use a the coordinate system to reposition a ROI, we call that same VI with the Get Coordinate System function code (second call in your diagram).

In that case, the reference system harcoded correspond to the Measurement System (result of the pattern matching at the time you drew the initial ROI we need to reposition - it is not shown in your code snippet and should be right after). That is why the reference system is hardcoded: it corresponds to the results of the pattern matching computed on the image where you initially drew the ROI you want to reposition. If the image you used in Vision Assistant when you inserted the Set Coordinate System step is different from the image you used when you inserted the following step where you want to reposition the ROI, the reference system of the Update Coordinate System call and Get Coordinate System Call will be different.

 

Hope this helps.

 

Best regards,

 

Christophe

 

 

 

 

 

Message 4 of 5
(5,897 Views)
Solution
Accepted by topic author CAS_MattF

Run example code Label_GoldenTemplate_L8.vi

 

This code demonstrates setting up and using the dynamic reference coordinate system for Golden Template Inspection.  Template_L8.png was created from Label08.png. 

 

Update Coordinate System: Location of Template_L8.png matched to any label image. This is dynamic to every new image.

 

Get Coordinate System: Location of template when patterned matched to Label08,png (reference). This is static for every subsequent label image.

 

Code is a bit "messy" becasue it was originally generated using NI Vision.

Matt Fitzsimons
NI Alliance Member
LabVIEW Champion
NI Certified LabVIEW Architect
LabVIEW, LV-RT, Vision, DAQ, Motion, and FPGA
0 Kudos
Message 5 of 5
(5,820 Views)