06-11-2014 08:06 AM
Hi,
I'd like to convert a 2D array to 1D array of cluster of 2 elements and I don't know how to do it.
I use IMAQ ImageToArray to have a 2D array like that :
0 0 0 255 255 0 0 0
0 255 0 0 0 0 255 0
255 0 0 0 0 0 0 255
0 255 0 0 0 0 255 0
0 0 0 255 255 0 0 0
and now I'd like to use IMAQ Fit Circle 2 but it needs "1D array of cluster of 2 elements" in input. More specifically, it needs an array of point coordinate cluster (with minimum 3 points coordinate cluster).
See my diagram attached.
Thanks a lot
Solved! Go to Solution.
06-11-2014 03:29 PM
Which elements in the 2D array go to what locations in the cluster and in the 1D array?
For a 2D array like this (with multiple values so we can tell which element moves where):
0 1 2 3 4
5 6 7 8 9
10 11 12 13 14
15 16 17 18 19
does the 1D array become [0,1] [2,3] [4,???] ... Is the next element [4,5] or is the odd numbered element dropped and the next point becomes [5,6]?
or does it become [0,5] [1,6] [2,7] [3,8] [4,9] then [5,10] or [10,15] ?
or some other pattern?
Lynn
06-12-2014 03:46 AM
I don't know how to answer to your question because I don't really know what I have to do.
I have something like this :
0 0 0 255 255 0 0 0
0 255 0 0 0 0 255 0
255 0 0 0 0 0 0 255
0 255 0 0 0 0 255 0
0 0 0 255 255 0 0 0
and I just want to find the best circle (using IMAQ Fit Circle 2)
this VI needs in input an "1D array of cluster of 2 elements" more precisely "an array of point coordinate cluster", I understand that he wants coordinates of all my points wich have a value of 255.
So, for the first point 255, I think I need to have [1,4] (First line, Fourth colomn)
Maybe I'm wrong, I don't know if you understand the problem like me
06-12-2014 05:31 AM - edited 06-12-2014 05:39 AM
@Noovn wrote:
this VI needs in input an "1D array of cluster of 2 elements" more precisely "an array of point coordinate cluster", I understand that he wants coordinates of all my points wich have a value of 255.
So, for the first point 255, I think I need to have [1,4] (First line, Fourth colomn)
Well exactly! So what is problem? With getting coordinates of those points?
Here's an example how to do it:
06-12-2014 05:41 AM
If I ask the question here it's because I didn't find an answer in Labview help...
Indeed, I need to find coordinates of my points equal to 255.
I tried to use Min/Max of an array to have index of my maximums (255), but it gives me only the first point equal to 255, or I need all indexes of all my maximum.
How can I do that ?
06-12-2014 05:43 AM
Thanks Adam Trojak !! I will try this !
06-12-2014 05:49 AM
06-12-2014 07:16 AM
thanks all for your response.
Thoric, in you diagram what do you use ?
(I circle in red some things that I don't understand)
Is it "build array" ? because my icon is not exactly the same but maybe it depends on your version of Labview
06-12-2014 07:22 AM
The first circle is an Array Constant with a cluster of two I32s in it. I is basically a constant of what your output should be, except the array is empty.
The second one is the Build Array. The icon changes based on what is wired into it. In this case, we are adding a scaler to an array. Once you wire it up, it should match just fine.
06-12-2014 07:49 AM
Now it's ok but I don't understand why Labview give me an error : "You supplied an insufficient number of points to perform this operation."
However, on my image (white circle) there are lot of points wich are at 255.
So what is the problem ?