LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

compare array of picture

Hi all,
 
I need some help on these.
 
A black and white picture (bmp file) is to be opened and let say that the picture is divided into 4 quarters. If as long as there is a white spot on the top left quarter, the program has to be able to identify it as pattern A.   Likewise if there is a white spot on the top right quarter, the program will identify it as pattern B.
 
Please advise and thank you in advance.
 
 
Regards,
Lip Seng
0 Kudos
Message 1 of 6
(3,196 Views)

First, you read the image with the 'read bmp file'.   Then you use the 'unflatten pixmap' to convert the picture data into an 2D array of booleans or integers.  Now you can use the normal array routines to do whatever you like to the image.   You could take a subset of the 2D array representing the upper left corner and add all pixels togethers.  If the answer is > 0, then there's a non-black part in the image...

Another option would be to first select a part of the image, before you convert it to .  You can cut that part from the image with the 'get image subset'.  Then convert only that small part into an array.    That's better when you have really big images.

Documentation warns me that these vi's aren't in the base package....   What package do you have?
0 Kudos
Message 2 of 6
(3,183 Views)
Hi,


It's hard so give a solution without seeing the picture. "Black and white" and "white spots" are open for interpretation. (B&W could be gray, white spots can be different sizes, what is the level of the background noise, how consistent are the picture colors, etc.)


In the simples case (the spots have high intensity level and are of significant size, background have low intensity level, low bg noise level) I'd try this.


First, I'd divide the 2d picture data into 4 separate arrays. Then, get a histogram of each array. Get the amplitude of a representative value, and check it against a value. If it is higher, there must be a white spot.


(Even simpler.. If there is only one pixel against a totally black bg, just use a array max & min, and you instantly have the index of the spot!)


Regards,


Wiebe.
"Lip Seng" <x@no.email> wrote in message news:1140014568345-325114@exchange.ni.com...
Hi all,
&nbsp;
I need some help on these.
&nbsp;
A&nbsp;black and white picture (bmp file) is to be opened and let say that the picture is divided into 4 quarters. If as long as there is a white&nbsp;spot on the top left quarter, the&nbsp;program&nbsp;has to be able to identify it as pattern A.&nbsp;&nbsp; Likewise if there is a white&nbsp;spot&nbsp;on the top right quarter, the program will identify it as pattern B.
&nbsp;
Please advise and thank you in advance.
&nbsp;
&nbsp;
Regards,
Lip Seng
0 Kudos
Message 3 of 6
(3,178 Views)

Hi Anthony,

Thanks for your reply. I think i will choose the 1st option. I am still green to labview and i am trying to do what you have suggested. But I do not know how to seperate the main array to sub array, and then add the pixels value together to compare. Pls advise.

Thank you.

 

The following diagram is what i have done.

0 Kudos
Message 4 of 6
(3,165 Views)

Unfortunately, I can't see your diagram.  

I've made a little example program, going through all the steps;   Getting the file, taking a subarray, and then analysing the subarray.  

Included three different possible analysis schemes:   Finding the maxima, getting the sum, or doing a complete histogram, like Wiebe suggested.

Depends on the exact problem what kind of scheme you would use.     

NB:  The example program is made for 8-bit bmp's.   (Thus either 256 grayscale levels, or colours.)

Message 5 of 6
(3,159 Views)
Hi Anthony,
 
Thanks for your example and advise, I will work on it.
0 Kudos
Message 6 of 6
(3,142 Views)