Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Video Contrast and Brightness Issue

Hello,
 
I'm using the 6025e DAQ in order to acquire an analog video signal. The signal is very slow, and the VSync is of order of 1 second. (Each second a new frame). There is a  loop which controls this routine of reading this data and then by using IMAQarraytoimage I get the picture. I want to be able to change contrast and brightness of the image on the fly, meaning that even though the new frame has not yet been updated, these features would have an immediate impact on the current picture. For this I have built an additional loop which handles event cases of contrast and brightness value change. The problem is that even thoght while I'm changing the contrast and the brightness value, I see the impact, the current frame responds well, when the new frame arrives, it uses the previous contrast/brightness settings and so it "goes back". Only on the next frame, does it use the newly set contrast/brightness.
 
I've attached the these 2 sections from the application for you to see.
 
Thank you.
 
 
Download All
0 Kudos
Message 1 of 2
(2,977 Views)
Hi Mic_Scale,

I hope you're doing well.  This sounds like a pretty interesting application.  From the information you've provided, it sounds like there may be some kind of race condition with the two loops updating the same local variables at the same time.  The problem with having two loops writing to one data source (like a local variable) is that one loop can update the variable, and then the other loop may write over that value before the initial value can be used.

What could be happening is that first, your event structure loop (the one shown in Cont_Bright_Event_Case.jpg) that executes when the Brightness/Contrast values are changed (thus updating your "VIDEO" local variable).  It looks like it only updates 1 frame of video with the new Brightness/Contrast values, which the DAQ card sucessfully outputs.  On the other hand your loop that is actually making the DAQ calls (the loop in Cont_Bright_Video.jpg) also has it's own algorithm for updating the "VIDEO" local variable as well.  It's possible that this loop is changing the values back to the "pre-change" values, then after it finally updates it's next frame, it permanently sets the new parameters.

This is a little difficult to tell from the information provided, but what I would do is try to step through the program using the LabVIEW debugging tools or using the Highlight Execution option.  This will change the timing of your VI execution and you may not run into the same race condition exactly, but it will give you a better idea of what code is updating the local variable at what time, and may help pinpoint this race condition.  Let us know if this helps, or if you have additional information from your debugging as well.  Have a great day!

Thaison V
Applications Engineer
National Instruments

0 Kudos
Message 2 of 2
(2,956 Views)