LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Image Flicker with USB IMAQ vision

Solved!
Go to solution

Hi to everyone

 

I'm developing a simple motion detector/tracking system using a USB WEBCAM, i've computed easily the frame difference, among successive frame, using a case structure that exploit a while loop to store in two buffer two successive frame.

Using IMAQ subtract over the two stored image i've obtained the difference image. On this image i've performed an image casting using the IMAQ cast image module, and successively i've applied in cascade the following modules:

 

1 - IMAQ BCGLookup (To enhance Brightness and contrast of the difference image)

2 - IMAQ AutoBThreeshold 2 (To obtain a threesholded image)

3 - IMAQ GrayMorphology (To enhance object shape int the threesholded image)

4 - and finally IMAQ Count Objects 2 (To count and track obejcts in the scene)

 

The result is almost good (is not a real motion tracker but it suffice for my purpose).

Now my problem is related to the image flickering effect on the display image area, that make impossible to see image result on front panel. A Highlighting on the block diagram allows to obtain a more stable image (even if highlighting after the application of IMAQ count Objects flickers however). The Flickering effect is absent in a simple vi writed to visualize webcam source.

 

Now what i have to do to remove this effect ?? Is a system problem or a problem related to the webcam video sampling (I'm using a low cost webcam with a resolution of 640x480 15 frame/s)?

I've aleady readed some posts of other person, in this forum, on this problem but my case is slightly different. 

 

to overcome misunderstanding of my explanation i'm attaching a view of the diagram that i've realized.

 

Thanks in advance for any answer that you can give me about this problem.

 

 

 

 

0 Kudos
Message 1 of 19
(6,954 Views)
I don't know what have to do to solve this problem, any answer would be of great help, thanks in advance to anybody that is able to give me some indication in solve  this problem!
0 Kudos
Message 2 of 19
(6,934 Views)
Create another Image reference using IMAQ Create.vi to use as the destination for the Cast Image function and see if that is enough.
Message Edited by rpursley8 on 07-23-2009 03:31 PM
Randall Pursley
0 Kudos
Message 3 of 19
(6,914 Views)

Hi Randall Pursley
 
Thank you very much for your answer! 
as you suggest i've added the IMAQ Create to the image dst of the module IMAQ Cast Image, the flickering effect is decreased, but not at all.
A question i've to add also an additionally IMAQ dispose ?? and more to totally remove the flickering effect, i've to add other IMAQ create module to the other module with Image dst input ?? Sorry for my  unsuitability, but i'm newer to labview !!!
 
Anyway thank you again for your suggestion, now i have something on working!!
 
Dave 
0 Kudos
Message 4 of 19
(6,910 Views)

I am not sure what you do in that last vi in the chain, but if you create another image reference and add it as an input it into that vi, you can use the new reference as your image destination. That should eliminate the flicker, since your image control will now be showing only the data coming from the new reference which will only update one a loop cycle.  If you didn't already know, the flicker is actually the image control trying to keep up with the changing data as you process the image data.

 

The IMAQ Dispose has a Dispose All input that you can wire with a boolean.

Message Edited by rpursley8 on 07-24-2009 03:06 PM
Randall Pursley
0 Kudos
Message 5 of 19
(6,880 Views)
Hi Randall

Thank you again for your help.
first of all sorry for the dirtness of my block diagram, 
but as i've already sayed i'm newer to labview, and still
i haven't acquired a methodology in develop ordered block 
diagram, i'm a programmer and i've practice in write 
classic code.

Anyway the last vi (named overlaying in the last image of my 
block diagram that i've attached to this post), 
attempt to rewrite information of objects,
identified by the IMAQ Count Objects 2 block module, into
the original image obtained from the webcam. This operation 
is performed simply using the IMAQ Overlay Rectangle module 
over the webcam source image. 
Then is not possible to use a new reference over this
vi, i've tried the solution that you suggest, but 
without improvement.

In this last screenshot of my block diagram as you can see 
i've added the image reference that you suggest, and i've 
also duplicated the IMAQ USB Grab Acquire outside from 
the case structure in this way i've reduced drastically 
the flicker effect. 
I've also added another buffer from the webcam source 
image to the last module (overlaying module). Nevertheless
the image still has flicker. In particular the display
"Webcam image" has a black frame every two three seconds.
While the display "overlaying" at the image output of the 
overlaying vi don't have flicker, but it keep all the 
rectangle, obtained from the IMAQ count Objects 2  
that i try to draw over the webcam source image.

Now the result is almost acceptable the flicker effect 
don't make impossible read the displayed image. I'm 
trying to make perfect my work, studying the use of IMAQ 
Overlay rectangle, to keep only the actual rectangle discarding 
all the previous rectangle, and removing totally the remaining 
flicker effect

Davide

0 Kudos
Message 6 of 19
(6,863 Views)

 

Take a look at the CASE structure in the top left part of your loop.  It looks like you have left some outputs unconnected in the cases that I cannot see.  Make sure you wire all outputs in all cases in the CASE structure.

 

As for the Image reference, what you did is not what I meant.  If you post your code, I will show you the modifications that I am referring to.

Message Edited by rpursley8 on 07-28-2009 03:34 PM
Randall Pursley
0 Kudos
Message 7 of 19
(6,813 Views)
Take a look at the attached.
Randall Pursley
0 Kudos
Message 8 of 19
(6,805 Views)
Hi Randall

about the case structure you have reason, now i've linked some wire 
in the default case (-1), that i didn't link before. Initially 
i haven't idea on how link wire in this case, because the case 
structure need to collect successive frame, to make difference among 
this.
In last days, how you can see, i've modified my diagram, and i've 
added some winddraw video display module, but the flicker effect
is not totally removed, anyway the result is almost acceptable, 
even if there is some delay in the overlaying of the rectangle 
on the source image.

Now i'm seeing your attachement. Thank you for this so polite, diagram
i suppose that you've realized this on the base of my posted picture.
I've tried to run it but the displayed output result is a little bit different,
from what i want to realize, anyway is a very good diagram, i'm studying 
it to understand.
 
As you ask i'm attaching to this post my code, so you can compare 
the results of the two code.

Thank you again


Davide

0 Kudos
Message 9 of 19
(6,772 Views)

Take a look at the attached.  I added your sub vis to my existing program.  You had two issues that I saw with yours.

 

1.  There is a bug with the USB camera grab that forces the image output to be RGB32.  Since the  Canny Edge Detection.vi needs U8 images, you need to Cast them as such before passing them into that vi.

 

2.  I added a control to the front panel to set the Filter Parameters for the Canny Edge Detection.vi.  This will give you more flexibility in the edge detection.  Play around with the parameters to see how they affect the image.  You can probe the output of the edge detector vis to see these images on the fly.

 

 

 

Randall Pursley
0 Kudos
Message 10 of 19
(6,745 Views)