Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Keyboard backlight on/off Image comparison using VDM

Hello.

I am deveoping a quick test to compare 2 keyboard  images (handheld computer) using grayscale . One with keyboard back light on and one with out (same keyboard) but the pixel subtraction gives an error following condition.

 

a) Same keyboard without backlight

b) Same keyboard without backlight

Images are taken from USB3 Basler camera

expect no error.

 

please comment.

 

Thanks,

V.Elango

 

 

 

 

Download All
0 Kudos
Message 1 of 6
(4,822 Views)

V. Elango,

 
When you say error, do you mean some margin of error that you would expect to be 0 because the images are identical? Or do you mean that LabVIEW is throwing an error?


Additionally, I would recommend that you avoid sequence structures--especially stacked--for your applications. If you use a enumerated state machine your code will be more readable, flexible, and debuggable. As it stands I would be very hard-pressed to track the flow of your program. Local variables are generally frowned upon as well unless there is a reason that you NEED them, and from what I can tell a shift register would accomplish everything you need in your application.

I did look at where that number is calculated, and it would seem that:

1. You check to see if the pixel values are equal in both images.
2. You convert that to a I16 array, then an I32.

3. You sum the values in that array to get the total number of unmatching pixels, and you multiply that by 100.

 

4. You use Array Size to get the dimensions of the array.

5. You multiply them to get the total number of pixels.

6. You divide the number of unmatching pixels*100 by the total # of pixels so you get the ratio of unmatched to matched pixels.

7. You check if that's less than 10%.

I think the problem is that you have no tolerance in your comparison. Instead of asking if A[n] == B[n], you should be asking is A[n] == B[n] +/- x, where x is some acceptable tolerance.
Basically, 0x00 and 0x01 are both white, but your program would say that they aren't.

Tanner B.
Systems R&D Engineer - Aerospace, Defense, and Government
National Instruments
0 Kudos
Message 2 of 6
(4,765 Views)

Thanks so much Tanner ,

I will change it to state machine later on. my problem is same identical images taken from a USB3 camera  shall report 0 but it is not.

I will ad the tolerence.

Thanks,

V.Elango

 

 

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

also tell me how to capture and ROI to an array.

0 Kudos
Message 4 of 6
(4,760 Views)

Do you mean how would you capture a subset of an image and return an array of it? There are several ways to go about this, but there is an example in Example Finder that shows how to apply a mask to an image based on a region of interest. I would suggest checking that out.

Tanner B.
Systems R&D Engineer - Aerospace, Defense, and Government
National Instruments
0 Kudos
Message 5 of 6
(4,754 Views)

Thanks , I will check that out.

Elango

0 Kudos
Message 6 of 6
(4,739 Views)