LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

dynamic filling and removing binary gaps in 2D array

Dear Labview users,

 

I'm trying to come to a software algorithm, but I'm not capable of realizing that due to some inexpericience with the 2D arrays. 

 

I have a large 2D array of 570 rows and 8 columns, which dynamically change of its values everytime a new image is captured. The values inside the array contain boolean true false values. 

I want to construct a software loop which automatically checks in every column if there are "gaps" between some apperantly consecutive sequences. I want to introduce an input control of the amount of maximum data values in between a gap. The same input control should be used in a "second" routine to remove small connected consecutive value sequences. 

 

In the attached picture the input array and desired output array (which talks a little bit better Smiley Very Happy )

 

filling and removing gaps.png

 

In the above picture the left array the input and right the desired output array. The input for filling and removing gaps is set to 8. 

In column 1 there are only 3 consecutive true value's, so these are removed from the output array. In column 2 there's a gap of 3 values. 3 is less than 8 so the gap is automatically filled. The same counts for column 3 (7 value gap), column 4 (2 value gap), column 6 (3 value gap).

 

The filling gap should be more important than the removing gap protocol. In case there are 7 consecutive true values, followed by 7 consecutive false values and followed by 7 consecutive true values, this should result in a filling action resulting in a 21 consecutive gap.

 

I've tried some rising, falling edge detection and search command, but it still doesn't work efficiently. I'm now a bit confused in this algorithm. In the attachment you can find the Labview 2012 software algorithm, which is still not perfectly working.

 

Thanks in advance,

 

Pieter Blok

The Netherlands

0 Kudos
Message 1 of 2
(2,629 Views)

Hi Pieter,

 

I want to construct a software loop which automatically checks in every column if there are "gaps" between some apperantly consecutive sequences.

Then you should start with counting each sequence of booleans!

- Get a column from your 2D array (using autoindexing)

with each 1D array:

- count your sequences: you might use Search1DArray to search for the next TRUE/FALSE bit...

- when you have a sequence of FALSE values with a count less than your limit: invert it (or replace it with a sequence of TRUE values)

 

Counting bit sequences is asked for often, just du a search in the forum to find related threads!

Best regards,
GerdW


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