07-14-2014 12:42 PM
Hello everyone,
I have a problem in image display. What I want to do is simple: have a window for real-time display from camera, a snap window to capture/save the image once I hit the button snap, and a third window to display the overlap of the captured image and the real-time image. The camera is a color camera. I have some problem in display the overlapped image:
First, here is the image that I should see (the captured image):
However, after I add it with a zero image (all the pixel value is 0) and display it, here is what I get:
Besides this wired display, the overlapped image can't be displayed in real time... So what's wrong with my program? I attached my block diagram.
Thanks so much!!!
07-14-2014 01:11 PM
You can't add color images the way you did. Color images are represented by U32 values. The U32 value is three U8 values joined to represent the intensity of each color plane. Doing math on the U32 value shifts bits from one color to the next, giving you the crazy rainbow image.
You could use IMAQ Add to combine them, but that would limit each color to 255. I would probably divide each image by two (IMAQ Divide), then use IMAQ Add to combine them.
Bruce
07-15-2014 10:30 AM
Hi Bruce,
Thanks so much!!! That makes a lot of sense!!! The only problem I have now is that I don't have IMAQ ADD or IMAQ DIVIDE in the Vision and Motion Palette. I will try to figure it out.
Xinyu
07-15-2014 10:40 AM
You must not have the Vision toolkit.
Another option is to split the U32 into the U8 components. You can do your operations on each component, then combine the components back to U32. I think Split Value and Join Values are what you would need. If you do this approach, make sure you don't exceed your limits. For example, if you want to add two U8 values, you should convert them to U16 first. Get the values back in the proper range (divide by two), then convert back to U8 before joining.
Bruce