LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Rotating Live Video

The forums have been very helpful up to this point, so I am hoping that someone out there knows how to fix this issue.

I am trying to use Labview to rotate live video (30 fps or as close as possible), and I am running into a problem; the video ‘twitches’ between no-rotated and rotated frames at a random interval.  I cannot store the images to the pc since this is an application where live video is required.

I am using a USB webcam, and have installed all the required drivers and such to make it work with Labview (Labview 8, NI Vision 8.2.0, NI-IMAQ 3.5.1).  I am able to get images from the camera just fine.  This is a test run for the real camera components that are ‘in-the-mail’.

 

I am not using a video capture card from NI, the camera that is coming will be through USB as well.  What is interesting is a NI rep came and demonstrated the video manipulation using a fire-wire camera running on a PXI chassis, and his did the same thing.  At the time we figured it was because it was put together within a couple minutes, so there was something probably missing.  I am ending up with the same result.

Attached is a picture of the program as is.  I have a program that I wrote in VB to accomplish the same task, and it did not have this twitching issue.  We are looking into coupling this video manipulation with motion, and the thought was Labview would allow for a clean integration of both.  I just can't fgure out why it is doing this.

Thanks for any help

Rich




0 Kudos
Message 1 of 4
(3,399 Views)

Hi Rich,

The flickering you are seeing is due to the fact that the IMAQ image data type is handled differently than other LabVIEW data types.  Wires containing images only contain a pointer to the image, not the actual data like with a wire containing numeric data.  In this case, the wire going into "Image In" is the same image as the wire going out of "Image Out" on the Grab VI.  So, the image flickers because the image is unrotated for a small amount of time before the IMAQ Rotate VI executes, and the Image display updates each time the image changes.

The solution would be to create two separate image buffers, one for the acquired image and one for the rotated image (two instances of IMAQ Create).  The acquired image would go through the Grap VI and into the "Image Src" input of the Rotate VI, and the rotated image would be wired to the "Image Dst" input of the Rotate VI.  This way, the image display will only be linked to the rotated image, and it won't try to update with an unrotated image each time a new image is acquired.

An alternate solution, if you do not want to create two different image buffers, would be to set the image display to use Snapshot mode.  This will make the display behave more like a "normal" front panel indicator, and it will only update when a value is passed to it on a wire.  On the front panel, right-click the border of the image display, and select "Snapshot".  Please let me know if this helps, or if any of this is unclear.

Chris M
Applications Engineer
National Instruments

0 Kudos
Message 2 of 4
(3,374 Views)
I tried the wiring suggestion, and that seemed to make it worse, but I may not have wired it correctly.  The snapshot trick seems to have done the trick.

Thanks

Rich
0 Kudos
Message 3 of 4
(3,367 Views)
Rich,
 
Try the attached VI.  It should perform the way you want.
 
Chris M
Download All
Message 4 of 4
(3,353 Views)