10-20-2009 01:08 AM
Hi, I'm calling IMAQ Stop to end an acquisition but it consumes 100% of my processor and takes 10sec to complete (all the while consuming 100% CPU). In our application we start and stop the camera regularly and this is exactly when the user wants the program to be interactive so this 10sec delay is a big irritation to them.
My setup is - Dalsa Piranha line scan camera, RT 9 running on a desktop PC (it is compatible according to the test), PCI-1429 cameralink card.
Any help or comments welcome.
Thanks.
Solved! Go to Solution.
10-20-2009 07:40 AM
10-20-2009 02:21 PM
Here is a similar code sequence that exhibits the same behaviour. A frame consists of 250 lines and the frame rate is 25fps.
10-20-2009 02:33 PM
Hello,
Is it not your image processing code that cost 10s of CPU ?
if yes the way is to write image process in more segmentable parts (if possible)
what happens if you test code without image Stuff ?
Regards
Tinnitus
10-20-2009 11:04 PM
10-21-2009 09:33 AM
Hey Anthon,
How are you measuring the time it takes for the IMAQ Stop.vi? In your screen shot, there is no indication that you are explicitly measuring the time it takes for the IMAQ Stop.vi to execute.
Also, what happens if you remove the IMAQ Stop.VI and just use the IMAQ Close.vi? This would still be a valid way of terminating your IMAQ session as the IMAQ Close.vi "Stops the acquisition if one is in progress, releases resources associated with the acquisition, and closes the specified IMAQ session." I would be curious to see if only using the IMAQ Close.vi eliminates or reduces this delay that you are seeing.
10-22-2009 01:26 AM
Ah I have managed to solve this one, but first here are the answers to your questions:
Using Stop and then Close or just Close makes no difference. The Stop was taking so long that I simply used a probe before and after it on the error cluster and with 2009's probe timestamp function I could easily see how long it took. For more detailed timing analysis I use the us timer available with RT.
In any case, the way I solved the problem was by making sure that I stop the acquisition BEFORE the line clock to the camera is stopped. So IMAQ Stop probably waits for the end of the current frame before it returns - and if the line clock stops halfway through a frame (as was the case), a 10 sec timeout probably causes Stop to return eventually.
The line clock is being driven by a DAQ card (via RTSI) and I simply closed the session to that counter AFTER calling IMAQ Stop. The DAQ interface is not shown in the example above as it is coded in a different vi.
Thanks for all the help.