03-31-2014 07:16 AM
You read it right: my VI displays 8-bit data with colour. Well not exactly with colour, but let me explain.
I wanted to do some basic image processing and tried to following:
Grab an image of my webcam
Convert this image to 8-bit
Turn the 8-bit data into an array
Divide the array with a specified number (two, three, four etcetera)
Display the new array
However, this causes a flickering in my display. It does display the normal video with an 8-bit divided by the number, but it flickers back and forth between multiple modes, including normal 32-bit full colour view. About one in about every 5 or 6 flickers is a full colour view. Can anyone tell me what has gone wrong here?
Solved! Go to Solution.
03-31-2014 07:46 AM
Hi
There is no destination image wired to your image cast. If you create another image of type U8 outside of the loop and wire that to the destination input of the cast you will be good.
The output of the cast is overwriting the original image. The display points to the image and depending when it updates will result in a different image being displayed.
I am sure that we have all done this at one point or another.
Mike
03-31-2014 08:28 AM
How can I do that? If I need the Cast Image to create an 8-bit display, then how can that work? I tried a couple things that might do what you mean, what you can see here. How can I create another image and use that as reference? I tried looping the entire thing back through an display, a cast image VI and a couple of other things, but none remove the stutter.
03-31-2014 09:28 AM
I tried the following:
I tried this along other things. I tried renaming the IMAQ image I call here to 'Reference', I tried putting it inside the loop, I tried many kinds of wiring the 8-bit signal back to the 'destination image', but no matter what I do, I keep the stuttering.
03-31-2014 09:36 AM
For the array to image, use the output from the IMAQ Cast, not the original color image.
Bruce
03-31-2014 09:45 AM
You mean like this?:
This does remove the flickering, but I can't remove its brightness by any number anymore. It now stays the same. I tried it with and without a seperate Imaq create inside and outside of the loop, but that doesn't work either
03-31-2014 09:58 AM
You could create another image for the destination of the array to image. Another option is to right click on your image display (front panel) and select Snapshot. That will make a copy of the current state of the image for display.
Bruce
03-31-2014 10:01 AM - edited 03-31-2014 10:04 AM
Yes, thank you so much, it worked. But would you be so kind to explain why the snapshot works? For I have no idea why it works now. It also seems that I don't need to have a seperate 'IMAQ Create VI' for the destination now. Just setting it to 'Snapshot' removes the stutter and does everything I want. How come?
03-31-2014 10:21 AM - edited 03-31-2014 10:22 AM
Usually the front panel image control updates the image constantly independent of the code you are running on the block diagram. So whatever is in the image buffer is just displayed at whatever rate your front panel updates at. So when you are using the same buffer to (1) convert from U32 RGB to U8 and (2) feeding in your array after dividing by 4, it is possible that at some time either step may appear in the image display.
Snapshot mode tells the image display to not behave that way anymore. Instead, whereever you have the indicator connected, it will make a copy of the data in the buffer at that time and display that copy. The update will be tied directly to your code in the block diagaram. For your application, this will work just fine. For others it might be a problem if you want faster frame rates and these data copies take too long.
Hope this helps.