LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Images with different exposure time

Solved!
Go to solution

Hallo everybody,

 

I have a problem with my code (see attachment).

I use IMAQdx Grab2 VI to acquire images of my camera. This works very well!

But I want to acquire one image with short exposure time (to extract from this image a line profile) and one image with long exposure time (to see a bright image).

When I use my code something annoying happens: I see in my image display and in my line profile both images (the image with the short and then the long exposure time)!

I made many attempts to solve this problem – but so far I always fail 😞

 

How do I have to modify my code so that I see in my line profile only the image with the short exposure time and to see in my image display only the image with the long exposure time?

 

I would be very happy if somebody could give me a hint or rewrite my code!

Download All
0 Kudos
Message 1 of 9
(3,789 Views)

It looks to me that you have a single Image and are alternating putting a frame of long exposure and a frame of short exposure on the Image..  If your frame rate is sufficiently high, they will appear to be simultaneously displayed (maybe with some flicker).  Strange code ...

 

You should get rid of the Frame sequence.  They are almost never needed, and definitely is useless in this example.

 

Bob Schor

0 Kudos
Message 2 of 9
(3,742 Views)
If you need both images of different exposure you need to create two buffers using different names at IMAQ Create.
-In code right now single user buffer is created and the same is getting overwritten hence you will not be able to see both images.
Thanks
uday
0 Kudos
Message 3 of 9
(3,735 Views)

Dear Bob_Schor and udka,

 

Thank you for your suggestions!

I removed the frame sequence and I use different names at IMAQ Create (see attached code) – but this did not change anything.

Perhaps I made a mistake…

Could you please tell me how to adapt my code correctly?

Download All
0 Kudos
Message 4 of 9
(3,718 Views)

Here's a New LabVIEW Proverb:

 

Understanding the Principle of Data Flow mean You (almost) Never Use Frame Sequences!

 

The other weird thing is how you are using your Camera.  You have it set for Continuous Acquisition (but with only a single buffer!).  I don't know the Frame Rate, but you appear to be taking two Frames and attempting to alternate Long Exposure/Short Exposure between them.  I don't know the capabilities of the camera -- in particular, I don't know how quickly it can change from one Exposure Time to another.

 

While you are developing your code. why not simplify it?  Do two Snaps, not in a loop.  Set up Snap 1 with exposure time 1 -- put a delay (100 msec?) between setting the exposure and taking the Snap.  [This is one of the few places that you need a Frame Structure, as the Wait (ms) has few Data Flow "hooks" to anchor it in a sequence, so you put a Frame around it and make sure "the Error Line Runs Through It" (that's a bad pun on a book that came out in the '70s)].  Then do another wait, set up the other exposure, wait, another Snap, and compare the images.

 

If they do, indeed, look the same, maybe your Camera doesn't "do" variable Exposure time.

 

Bob Schor

0 Kudos
Message 5 of 9
(3,706 Views)

Dear Bob_Schor,

 

Thank you for your patient suggestions!

I tried to adapt my code as you suggest (see attachment). But I keep the loop because my program has to take many images (it must run live for many hours).

I hope I implemented your suggestions well - but the program still does not work correctly!

Perhaps I described the problem not well enough (I am sorry for may bad English):

My camera can quickly change the exposure time within 1 ms to 2 ms.

So, when I run my code the following happens:

I see in the image display and my array (line profile) both images, the image with the short and then the image with the long exposure time (this repeats all the time because of the loop)! But I want that the image with the short exposure time is only used for the line profile and the image with the long exposure time is only used for the image display.

How can I achieve this goal?

Download All
0 Kudos
Message 6 of 9
(3,700 Views)

I still see Frames!  And they are all "wrong".  Here's an example from your code:

Bad Frame.png

This frame involves acquiring an Image from the Camera, and a Wait of 110 msec.  Which comes first -- do we get the Image, then wait 110 msec, wait 110 msec then get the Image?  Can we say how long we stay in this frame?

 

The correct answer is "we don't know, it isn't specified".  The only thing we can say is that before we leave this frame, at least 110 msec will have elapsed and at least 1 frame will have been acquired.  We will also have processed a Line Profile.

 

Did you want an order to the sequence "Acquire Image" and "Wait 110 msec", i.e. did you want one of these to go first?  Did you want them to happen "simultaneously" (which, in fact, is what you programmed)?

 

Because Waits often happen before or after other things, let's assume you want to wait after acquiring the Image.  Here's the correct code to do that:

Good Frame.png

I've removed your Frame Sequence, used the Error Line for the IMAQ Line Profile (do you really want to do a Line Profile if the Grab throws an error?) and put the Wait inside a Frame that has to run after the Grab and before whatever follows the computation of the Line Profile.  Note that this frame takes a minimum of 110 msec, since we don't know how long the Line Profile might take.

 

There is another "timing" element that you have left out, namely the Camera itself.  What is its Frame Rate?  I continue to be puzzled why you have only a single Display Window for looking at two (alternating) Displays ...

 

Bob Schor

0 Kudos
Message 7 of 9
(3,691 Views)

Dear Bob,

 

Thanks again for your efforts!

 

I still see Frames! 

Sure, because from your post here I thought, I shall use some frames with wait…

Sorry, perhaps I totally misunderstood you!

 

I can follow your explanations with frames and wait well. Already before I post my question here, I tried for many days to solve me problem. I also tried wait and frames in many different combinations – but nothing works for me.

I fear I just do not see the correct solution!

 

I adapted the code as in your example (see attachment). This is indeed something I did not try before (thanks for the hint to use the Error Line for the IMAQ Line Profile too). But this does not have the correct influence on my program. 😞

 

The video here shows what my program does when I do not (!) use wait:

In the image display you can see alternating the images with short and long exposure time. The same can also be seen in the line profile.

But I want that in the image display only the image with the long exposure time can be seen (then this is bright and well visible) and in the line profile the image with the short exposure time shall be used (then this is less oversaturated).

I hope this solves your puzzle…

 

When I use a wait that is not 1000 ms or 110 ms (perhaps other values too), I still see alternating images. When I use a wait of 110 ms or 1000 ms, I can only see the entire time the image with the short exposure time in both, the image display and the line profile.

Unfortuantely, I could not find a wait which works for me. 😞

 

To my camera: I use this camera here which offers a maximum frame rate of 15 fps.

In my program, the frame rate is set to 8 fps (this is done at the beginning of my program by choosing the VideoMode).

 

I really would appreciate if you could help me again and perhaps post some further hints or code which solves my problem!

Download All
0 Kudos
Message 8 of 9
(3,672 Views)
Solution
Accepted by topic author partial81

I found a solution!
My code works fine when I replace "IMAQdx Grab2" with "IMAQdx Snap2". I even do not need two different "IMAQ create" at the beginning of my program as some suggested here.

Anyway, thanks for the interest in this problem. I am happy that I could solve this problem by myself!

0 Kudos
Message 9 of 9
(3,659 Views)