LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to search and match two set of X,Y coordinates

Solved!
Go to solution

Hello everyone!

I am trying to match two set of pixels coordinates (in string format)  for e.g set A= {(120, 300) , (100, 200) , (400, 500)} and set B= {(100, 200), (600,700)}. It should first match set B with set A such that it should give me a score whenever a coordinate of set B matches with one of the coordinate in set A. Here coordinate (100,200) of set B Matches with set A

Then it should give me a % match= matched pixels of set B in set A /total number of pixels in set B.

 

I have tried with MatchPattern.VI, but it gives me a match only when i search set B coordinates one at a time and not as a whole set of coordinates. 

Is there any other alternative or information by which I can match two set of coordinates like Inner join in table. Any help would be much appreciated. Thanks

0 Kudos
Message 1 of 9
(3,051 Views)
Solution
Accepted by topic author enthusiast4

Hi enthusiast,

 

just a very simple approach:

check.png

two set of pixels coordinates (in string format)

You can also compare strings, but it's probably more safe to compare numbers when you handle pixel locations…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 9
(3,041 Views)

Thank you for your fast solution. Only Problem is that my set of Pixels coordinates are in the form of string shown in the attached iage.

0 Kudos
Message 3 of 9
(3,032 Views)

Hi enthusiast,

 

what's your problem exactly?

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 9
(3,028 Views)

When im trying to convert the spreadsheet string into a 2D Array, ist giving me an extra column in Array indicator. Also, im confused how to convert this 2 D Array into  Cluster of Array (Cluster of X, Y coordinates) as you have shown in the VI. 

0 Kudos
Message 5 of 9
(3,024 Views)

Hi enthusiast,

 

basic rule: when YOU have problems with YOUR vi then YOU should attach YOUR vi here so WE can examine it…

 

There is a nice IndexAndBundleCluster function:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 9
(3,019 Views)

Sorry i didn't upload my VI in the first place. My whole application is a big one and here is a small Code in which I am stuck after converting into the 2D Array. can you help me in how to procedd? I tried with IndexandBundle Cluster before but i am not sure how to connect the dots to be same as your VI you have posted at first

0 Kudos
Message 7 of 9
(3,016 Views)

Hi enthusiast,

 

use my code above to compare your XY coordinates:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 9
(3,010 Views)

Thank you so much. I got the correct solution from you.

0 Kudos
Message 9 of 9
(3,006 Views)