05-19-2015 10:09 AM
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
05-21-2015 08:47 AM
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.
05-21-2015 09:42 AM
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
05-21-2015 09:43 AM
also tell me how to capture and ROI to an array.
05-21-2015 10:44 AM
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.
05-21-2015 09:18 PM
Thanks , I will check that out.
Elango