07-18-2013 09:21 AM
Hi all,
I am working on a relatively basic image acquisition and display .vi. One of the goals of this .vi is to calibrate our hardware by splitting the original image into 4 quadrants. We then perform basic addition/subtraction operations between the different quadrant image arrays to ensure that they overlap cleanly. In other words, we take two different quadrants and subtract the first from the second and then display the result. This is all clear to me, and seems to be working well.
My question has to do with the IMAQ ArraytoImage.vi. How does it handle the case where the array contains values outside the allocated space? We're using U16 Grayscale format but have the option to go to something else if necessary. Say one image has a value of 500 and we're subtracting off 600.. Is the -100 represented as a 0 or does it wrap around? Likewise how does an overflow, say 64000 + 3000 work out? I looked into changing the overflow settings in the add and subtract functions but this is only allowed for fixed point numbers.
Thank you in advance for your help,
Paul
07-30-2013 04:46 PM
Hi phogan,
If you have a U16 and you subtract a larger number from a smaller number, your result will be 2^16 plus the (negative) result. For instance if you have 500 - 600, the -100 would be represented as 2^16 - 100, or 65436.
If you add two numbers that exceed the maximum value, the count will roll over. So if you have 64,000 + 3,000, the result you will see is 1464.