LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

2D Array of binary Values -> Identify positive Areas in Array as Geometrys

Hey!

 

I have a 2D Array with binary Values. The array is mainly made up of zeros. But there are some areas in my array where positive Values are found.

I need to search my array for these Areas and extract the geometrys coordinates to a CNC-Cutting Machine (the binary array is a topographical image of a surface). Problem is, that these are no clear areas with clear edges, meaning there are also zeros in between, which have to be smoothened out before extracting the coordinates of the areas.

 

I hope I defined the problem clearly enough, does LabView have any function to realise this? My tries didn't function very well..

Thanks

0 Kudos
Message 1 of 8
(3,030 Views)

Hello there, as many here will probably say, we can't debug code we can't see, so providing it would help lots. Your explanation was not too clear to me, but if all you want to do is find which values in an array are positive, that can easily be done with an auto-indexed for loop and a >0 comparison. You would store the iteration number in an array which in turn, would output the array positions of the positive values.

 

Probably you would get more information if you clarify what you mean with "extract the geometric coordinates". Are the positive numbers the places where those are? Attaching what you have as code will certainly help.

0 Kudos
Message 2 of 8
(2,993 Views)

Thanks for your effort, I will elaborate further:

I need to recognize the contours of those areas to draw a parallel lines on them for processing.

There is not much of a code yet, but I drew you a pic of what I wanna do.

The X'es are positive Values, the empty spaces are zeros. The Output should be start and stop coordinates of these lines.

 

 

0 Kudos
Message 3 of 8
(2,956 Views)

Well that didn't clarify much, so I'm merely speculating here but... if that were a 2D array, the empty spaces would be zeroes, and the x would be non zeroes, so you would like to find out the (x,y) (line, column) position of said coordinates yes? That much can be achieved by the aforementioned auto-indexed for loop, two of them in fact, and they would deliver a map of booleans, highlighting which elements are positive.

0 Kudos
Message 4 of 8
(2,925 Views)

Thanks, your suggestions are right. But how would I achieve to only get the outline of the areas? Meaning the Paths where 0's and 1's are directly next to each other?

 

Important for my Program is only to recognize Areas and draw a pattern on them.

 

0 Kudos
Message 5 of 8
(2,913 Views)

Need some clarification... My understanding according to picture and discussion...

 

You have 2D binary array (positive = true).

You want to get an array of lines (indexi row_start, col_start, row end, col_end) that 

1) diagonals at 45 degrees top left to bottom right

2) go only through non-zero elements (or instead of 2 lines below [2 1 2 1], [4 3 4 3] should be a single line [2 1 4 3]?)

3) can have length = 1 (start = end)

So you will get coords of blue lines. 

array, lines.pngorig array.png

edit: wrong indexi in lines

0 Kudos
Message 6 of 8
(2,885 Views)

Wow, nice illustration, did you do that in LabView? You got the point of what i was planning to do.

 

1. 45 degrees is right, though im planning to let that be set by the user on interface (0° and 90° should also be possible in the final version, but thats far away yet).

2. The Lines can also go through zero elements in the case that there is a single zero element in between a positive field.

3. Theres a minimal lengh, under which I want to dismiss a (blue)line, which I dont know yet, because I have to find out by experiment.

 

My current plan is the following:

I installed the Vision Engine Module. I want to interpret my array as pic, I uploaded an example of an array which I visualised in excel, the red fields are 1's and the whites are 0's.

I want Labview to locate the visible red patterns or areas. First, I want to set the contrast higher, hoping it will get rid of zeros in between ones, so that i get clear bounded areas with positive fields. After that, these positive areas should be counted and measured in surface area each.

Then, the lines should be placed on top of the areas as you were showing. I want to make the distance of the blue lines to each other a function of the calculated area surface the lines are on.

For example: A big spot of positive values needs denser lines than a smaller spot.

 

I hope I explained it understandable, thanks for any help.

 

0 Kudos
Message 7 of 8
(2,866 Views)

Vision can help

There is array to image function.

Then look at Threshold - to convert image to binary if your original array is grayscale

Then Morphology functions to fill holes, remove small ones

Particle analysis report will give you location and surface of each area.

 

Then goes a little custom development, I doubt there is "fill area with lines of specified density"  vi.

Probably I would try edge detection along specified line. 

Scan particle area with lines, edge detection will give you start and end of the line. 

Message 8 of 8
(2,846 Views)