Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

How to properly deinstall a callback function triggered by 1394 events?

I'm using (in this order):
 
 
  • imaq1394InstallCallback( ... )
  • imaq1394ConfigureAcquisition( ... )
  • imaq1394StartAcquisition( ... )

to configure IMAQ and Vision to automatically acquire, preprocess and analyze an image from a 1394 camera. My goal is real time analysis of the images at at least 15 fps, so batch processing (first write all images to buffer, then analyze the whole image sequence) is (at least for the current project design) not an option.

After a fixed time, I wish the acquisition to stop.

How do I deinstall the callback properly to prevent IMAQ triggering the callback function when it's no longer needed? After imaq1394StopAcquisition() the callback function is often still triggered at least once.

I tried the following approach:

  • the main function is set to sleep while the callbacks are fired
  • after a fixed time, the main function wakes up and sets a flag (REQ flag) in the userdata the callback function receives as input, then sleeps in short intervals until the callback function flags an acknowledgement (ACK flag). When the callback function flags the ACK, it also runs imaq1394StopAcquisition
  • after the ACK flag is set by the callback function, the main function frees the memory

Unfortunately, the callback now STILL fires once again (trying to use the memory the main function just freed), though on my opinion after StopAcquisition this should not have happened.

What is the correct strategy to stop events triggering a previously installed callback function or to put it straight: What is the counter for InstallCallback?

Glad for any help ....

0 Kudos
Message 1 of 2
(3,289 Views)
Seems as if there is no answer to my question.
 
I'm now using this workaround:
- Call imaq1394Close() after time is up
 
 
Pro:
- Easy
Con:
- For any further use of the camera, a new session has to be opened and configured. Feels like walling up my house each time I wish to just shut the door
 
0 Kudos
Message 2 of 2
(3,247 Views)