LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert 2D array to 1D array of cluster of 2 elements

Solved!
Go to solution
Solution
Accepted by topic author Noovn

You need to make sure in your False case that you wire the cluster array straight through. It looks like you have "Default value" enabled for the output, which means in the false case you are clearing the array. This would marry with the error you are seeing regarding insufficient points - you are getting an empty array!

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 11 of 18
(2,636 Views)

You haven't wired the Array through the false case in your case Structure.

Whenever the false case is executed you "forget" all previously found points.

 

Best Regards

Florian

 

P.S.

Thoric beat me to it Smiley Happy

0 Kudos
Message 12 of 18
(2,632 Views)

THANK YOU VERY MUCH both of you !

You saved my life and I'm so glaaad 😄

0 Kudos
Message 13 of 18
(2,621 Views)

Are you certain that you will always get 255 for the points you want to analyze? Never 254 or 253?  If there can be other values, use a > 128? (or other suitable threshold) in place of the = 255? comparison. It will not change the performance when all the values are 255, but will allow for some noise if that is a possibility.

 

Lynn

Message 14 of 18
(2,613 Views)

yes, thanks for the advice !

0 Kudos
Message 15 of 18
(2,606 Views)
  • Now I have an another question (sorry to boring you) :


I have now 4 circles, and I want exactly the same thing (center, radius, area, perimeter) for each circle.
I found a VI named IMAQ Count Objects 2. (in Red on the image)

I tried to do a For loop and put number of object into it but I didn't succeed. How can I have the same parameters for circle 2, circle 3 and circle 4 ?


  • My second problem is circle in green on the image. I want my original image AND my edge detection on the same image. What I've done works, but the original image winks.
    I just want to superimpose the two images.

 

thanks a lot

 

Program :

Sans titre.png

0 Kudos
Message 16 of 18
(2,593 Views)

Regarding the first issue of characterising four circles, you'll need to separate the cluster of coordinate pairs into four arrays, one for each circle. If you know the four circles are in the four rectangluar corners of the image then you have several options:

1. break the image up into four images and perform your existing analysis (unchanged) on each image to get four results

2. modify the nested for loop that determine the location of '255' values to only look at a zone, such as the top left corner only, bet setting the for loop N values and accounting for any starting index offsets. Then perform that on each quadrant.

3. Within the nested loop, determine which of the four quadrants the coordinates are and place the result in one of four clusters of coordinates, one cluster for each quadrant. This is not the recommended way, but might be simpler for you if you are new to LV.

 

 

Regarding your second issue of wanting to overlay images, you need to mask out the black areas in your second image otherwise it will entirely cover up your first. It might be better instead to Draw Circles onto the first image, using the centre and radius information you gain from the analysis?

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 17 of 18
(2,565 Views)

For the second problem, I don't understand why (and how) I need to mask out the black areas...

Because if I add the two images, it's like I add a pixel value 0 to a 255 so 0+255 = 255 and not 0.

 

It seems to be wrong because it doesn't work ^^ I don't understand what I have to do...

0 Kudos
Message 18 of 18
(2,540 Views)