Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

IMAQ Add saturation issue

Solved!
Go to solution

I am taking a series of 10bit images, and to increase the effective exposure time of the camera would like to add up to 30 consecutive images together.  I am able to add the images using IMAQ Add, but the resulting image acts as if it were also a 10bit image and saturates at 1024 (2^10).  I don't understand why as the Image dst in the IMAQ add is wired to a I16 image, and so I was expecting that I would be able to add my 10bit images until I reached the limit of 16bits.  I'm new to all of this so it's likely that I'm just making a silly mistake. 

 

Currently I grab N successive frames from the camera using IMAQ Grab, then add each element of the resulting array to form the new image.

 

I understand that I could add up a subset of the images, then divide them by some power of 2, but I would like to understand why I currently cant use the full 16 bits of the image type.

Download All
0 Kudos
Message 1 of 7
(4,980 Views)

Hey casual,

 

I'm sorry, but your stacked sequence structure is near impossible to follow, is there any way you could attach your VI for us? If not, I can look at your images some more. Maybe you could also attach a handful of your images in a zip so that we can try some solutions on our end, and to see if we are also saturating at 10 bits even though you are adding 16 bit images.

Chris Van Horn
Applications Engineer
0 Kudos
Message 2 of 7
(4,965 Views)

Hi Chris,

 

Thanks for your reply.  Sorry that the pictures that I attached were hard to interpret.  The VI in its entirety is quite messy and very much under development so I have isolated the part of the VI that is behaving poorly.  Thesub routine is attached. I tested this and it behaves the same as it was when embedded in my code.

 

What I think I'm doing is, taking N consecutive frames from the camera (a Hitachi KP-F100 (10bit greyscale)) using our NI PCI1422 card.  I then add the N images together using IMAQ Add, and then display the image.  The resulting addition saturates at 10bits - rather than using the full 16 bits of the image type being fed to the IMAQ Add process.

 

Thanks for your help

Sam

0 Kudos
Message 3 of 7
(4,949 Views)
Solution
Accepted by topic author casualfanta
It sounds like the aquisition is marking the bit depth of your images to 10 bits. Have you tried using IMAQ Image Bit Depth to set the bit depth to 16 bits before you add?
Tyler Weston
Vision R&D
National Instruments
0 Kudos
Message 4 of 7
(4,928 Views)

Thank you

 

I suspect that will do the trick - I hadn't spotted that feature. 

 

Thank you

Sam

0 Kudos
Message 5 of 7
(4,907 Views)

Revisiting this issue:

 

I have a boatload of U16 images that I have to add together.  How do I avoid saturation in this case while using IMAQ Add function?

 

The IMAQ Image Bit Depth does not have an option for U32 (or SGL) which is what I believe is what is needed.

 

A workaround is to convert image to array and collect additions in SGL array.  But is there a way to do this just using IMAQ functions?

 

Sincerely,

 

Don

0 Kudos
Message 6 of 7
(4,265 Views)

Following up on this.  The addition of U16 images can be performed without fear of overflow/saturation by casting the U16 image to SGL type and creating an SGL image type for the sum as per the strategy below:

 

IMAQ Add strategy for U16.PNG

0 Kudos
Message 7 of 7
(4,233 Views)