Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Image Display

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: 

  •    the image display is very wired, it's like a heat map rather than a image
  •    the overlapped image can't be displayed in real itme

First, here is the image that I should see (the captured image):

captured.jpg

 

 

However, after I add it with a zero image (all the pixel value is 0) and display it, here is what I get:

image1.jpg

 

 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!!!

 

  

Download All
0 Kudos
Message 1 of 4
(5,189 Views)

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

Bruce Ammons
Ammons Engineering
0 Kudos
Message 2 of 4
(5,181 Views)

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

0 Kudos
Message 3 of 4
(5,149 Views)

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

Bruce Ammons
Ammons Engineering
0 Kudos
Message 4 of 4
(5,147 Views)