LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Subtract two I16 images?

I am working with a 16bit camera (data is native in a U16 format), but to work with LabVIEW functions (e.g. IMAQ add/substract etc. doesn't work on U16 images) I have converted to I16 format by first converting the array data from U16 to I32 and then subtracting 2^15 before converting to I16.  While I would prefer to be able to stick with U16 images, this seems like it could work. 

 

However, I now want to subtract one camera image (a dark count image taken with the lens cap on) from another camera image to remove background noise.  Since the dark count image is mostly low negative numbers in I16 format (low positive numbers in U16 format), subtracting a dark count image from another image actually adds counts to the original image  (i.e.  A - (-B) = A + B) and thus is not at all the same as (A - B when both are U16).  Can anyone recommend a simple workaround?  Can the powers that be at NI add U16 functionality to more of the basic IMAQ routines since 16bit scientific cameras are pretty much the norm now.

 

Thanks,

Matt

0 Kudos
Message 1 of 3
(3,367 Views)

Hi Canucklehead,

 

I am a little confused on this issue.  If you are concerned with A - (-B) = A+B, can you not simply instead use an IMAQ Add and do A + -B = A-B?

Message Edited by StarsHockey on 11-03-2009 06:06 PM
Stephen Meserve
National Instruments
0 Kudos
Message 2 of 3
(3,342 Views)

Hi Stephen:

Sorry I probably didn't explain that very wellThe attached .VI demonstrates the problem for a test 2x2 pixel array/imageIt seems a solution would be to convert I16 images to U16 arrays before any addition/subtraction but this gets cumbersomeAlso, as I see it, the IMAQ Add/Subtract vi's don't handle I16 operations logically if the image data spans the full 16bits of information and thus extends into negative countsOf course I chose the moniker "Canucklehead" for a reason!

0 Kudos
Message 3 of 3
(3,315 Views)