From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

sequence image acquisition

What I'm trying to do now is to move x-y state 2 dimensionally and take image at each x-y position. I have two different stages, one from newport and another from Velmex. As shown below, first I move the stage from newport and take image at each position, say 1st line of x direction. Then move to 2nd line by moving another stage from Velmex (now 2nd line of x dir). Now I want to take images at each position again in this 2nd line. To do that, what I am doing is to just copy 1st image acquisition sequence shown below after Velmex control (Sorry it's too long code to show) In other words, I just repeat the same thing as the 1st set, control stage and image acquisition. Then I can do what I want to do, but the problem is that when I copied the 1st image acquisition, it automatically creates 2nd image and 2nd camera name. It is redundant because now I have two camera images and input camera names. Does anybody know how to simplify the code?  

 

Picture 2.png

0 Kudos
Message 1 of 9
(3,180 Views)

Hello!

 

Thanks for posting your question here. I'm having a little trouble making the code out from the image, since it's so small. Is there a chance you could attach a larger (higher-resolution) image?

 

Thanks!

Caleb Harris

National Instruments | Mechanical Engineer | http://www.ni.com/support
0 Kudos
Message 2 of 9
(3,157 Views)

Hi Caleb,

 

Thank you for your reply. Since I got the long code, I separated it into two pictures. The first one is the loop for x-dir scanning with image acquisition at each position (1st line scanning). Then it moves to the 2nd picture (although I just showed partially). This is for the y translation and take an picture, say 1st position of the 2nd line. I repeat this process shown as "Total track" in for loop. The question is for the image acquisition, I don't need to have two images and two input camera name because I only have one camera. When I copy and paste the first data acquisition command to the 2nd one, it does not paste as the original, rather it creates the 2nd set.  

 

Picture 1.png

 

Picture 2.png 

 

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

Hello,

 

 

When you copy as you did, you are going to create another instance. If you are doing things serially, you can just use the second camera code again yet reference the same camera and image buffer. Your other option would be to have a camera loop that was triggered by the two loops you have.

 

-Zach

0 Kudos
Message 4 of 9
(3,124 Views)

Hi Zach,

 

 Thank you very much for your reply. Could you tell me how to reference? What I did is right click Image 1>Create>Reference, then wire this (it shows ImageControl) to IMAQdx Snap.vi of 2nd block. Then the wire became dotted and also showed red cross. 

 

Thank you,

 

ttnn 

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

I think what Zach's saying is that we don't have to create a new camera in the second frame. We can pass the old reference wires through the frames and simply re-use the IMAQ commands without creating a second instance.

 

large_modified.png

 

 large2_modified.png

Caleb Harris

National Instruments | Mechanical Engineer | http://www.ni.com/support
0 Kudos
Message 6 of 9
(3,105 Views)

Hi Caleb,

 

Thank you for your advice. However, if I tried the way you suggested, I got the following errors. 

 

Picture 1.png

Picture 2.png 

 

What is the problem here?

 

Thank you,

 

ttnn 

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

Hi ttnn,

 

It sounds like the reference wires have been "auto-indexed" between the first and second sections of camera code. It looks like there was a for loop border between them, and that's where this usually happens.

 

When you pass a wire out of a for loop, it generally performs an "auto-index" where it takes the value from each iteration and compiles them all into a 1-D array that it passes once the loop is finished executing.

 

In this case, we just want one value (since the value will be the same for each iteration anyway). To disable auto-indexing, find where the wire passes out of the for loop. The wire should change from normal to slightly thicker than normal, and passes through a terminal on the border that's partially white (or "hollow"). Right-click the terminal and select "Disable Auto-Indexing."

 

Do this for all the wires that are returning this error, and that should get rid of it.

Caleb Harris

National Instruments | Mechanical Engineer | http://www.ni.com/support
0 Kudos
Message 8 of 9
(3,069 Views)

Hi Caleb,

 

 Thank you for your reply. I connected wires as you suggested. but now I got another problem. It gave me an error "IMAQdx open camera.vi" , possible reason "Camera is already in use". It seems that at the first block, camera is opened, but for the second block, this first open disturbed the second one (because it says camera is already in use). So, instead of deleting Open camera.vi at the 2nd block, as suggested above, I use it at each block.

 

1st block 

 

Picture 3.png

 

2nd block 

Picture 2.png 

 

However, it does not solve the problem. I still got an error "Camera is in use". Do you know why does this happen?

 

Thank you

 

ttnn 

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