LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Comparing picture using matix

Dear all,
 
I am new to LabView and I want to know whether it is able to compare pictures.
 
The Program should work like this:
I open a picture (eg. "A.bmp") and compare it with another picture ( "B.bmp"), using their matrix (similar to IMREAD in Matlab).
If both matix are alike, then a pop up or a screen will show "A.bmp" is equivalent to "B.bmp".
If not, it will continue to compare with another picture.
 
I was wondering how can I convert the picture to matrix using Labview.
 
Could someone pls enlighten me on this. Thank you in advance.
 
Regards,
Tay
0 Kudos
Message 1 of 4
(2,999 Views)
Hi,
 
I wrote a quick program that will open two .bmp files and extract the image data.  You may encounter some problems;
1.  I wrote htis program in Labview 8, which is not backward compatible.
2.  I have Labview vision, the .bmp VI I used may nto be available without the Viosion module.
 
Let me know if there are any probems and I will fix them.
 
Chris
Chris Reyerson
Optical Systems Engineer
Arete Associates
Tucson, AZ
Message 2 of 4
(2,985 Views)

Hi Chris,

Thank you for your prompt reply and help. Didnt encounter any problem using your program when I use Labview 8 Evaluation. Have studied your program, but could not really understand the comparing part, is the program comparing the picture size or is it the picture data when they are both bmp file?

I am equipped with Labview 7.1 with vision, and i will try to convert and modify your program in it. But I have a concern which is whether the components in version 8 similar to version 7.1?

Thank you again.

Regards,

Tay

0 Kudos
Message 3 of 4
(2,977 Views)

Hi Tay,

First the program determines the number of pixels in each image and halts if they are not the same (this is the outer most case statement).  If they are the same, then it proceed to subtract one image from the other on a pixel by pixel basis, leaving you with an array containing the difference (equal in size to the image).  Then the program compares each element in the difference array to 0, this produces an array of booleans (true if the element is zero, false if the element is not zero).  If any element in the array is false, the images must not be identical.  I converted the booleans to a 0 or a 1 and sum up the array, if the array sum is zero the images must be identical.

Read the online help on the .bmp read VI.  You will see that the cluster contains several pieces of information on the image.  (Also, the way the color information is encoded in the data is interesting)  I extracted the element called "Image", which is the image data.  You can get at the size of the image too from the cluster information.  Left click on the unbundle by name where is says image, and you can choose any piece of information.

Using the evaluation copy you have of 8.0, use Save as to save as version 7.1, I think you can do that but I have not tried it.

 

Let me know if I can be of more help,

Chris

Chris Reyerson
Optical Systems Engineer
Arete Associates
Tucson, AZ
0 Kudos
Message 4 of 4
(2,974 Views)