NI Home > Community > NI Discussion Forums

Machine Vision

Showing results for 
Search instead for 
Do you mean 
Reply
Member
DeltaJ
Posts: 104
0 Kudos
Accepted Solution

Can you un-register from a Frame Done Event

Hi All,

 

I am acquiring form a camera using an architecture very similar to the one posted here. I am registering my camera for the Frame Done event and it is aquiring images with no problems.

 

What I would like to do is stop the acquisition. I have tried to deregister by creating a case where I register for an null reference (similar to how you dynamically unregister for a user or control event) but this threw up an error. I also tried to increase the 'buffer interval' to a huge number - this stopped the acquisition but when I tried to restart it the code hung - perhaps it was waiting for u32 frames to be acquired before acquiring again.

 

Is there anyway I can do this? Or would I be better off putting my code in a larger case structure where I can close the camera and re-open it later?

 

Many thanks in advance,

Dave

 

 

Member
Matt.S
Posts: 134
0 Kudos

Re: Can you un-register from a Frame Done Event

Hi Dave,

 

When you say stop the acquisition do you mean stop the program from running without error,  or do you want to stop the acquisition and then restart it pragmatically?

 

 

Matt Surridge

National Instruments
Member
DeltaJ
Posts: 104
0 Kudos

Re: Can you un-register from a Frame Done Event

Hi Matt,

 

I'd like to be able to stop and then restart the acquisition programatically. My thought had been to dynamically unregister and then re-register for the frame-done event by using an empty reference. Unfortunately this threw up a camera error when I tried it.

 

Thanks for your help,

Dave

 

 

 

Member
Matt.S
Posts: 134
0 Kudos

Re: Can you un-register from a Frame Done Event

Hi Dave,

 

Is there any options for triggering with your camera? 

 

Regards

Matt Surridge

National Instruments
Member
DeltaJ
Posts: 104
0 Kudos

Re: Can you un-register from a Frame Done Event

Hi Matt,

 

My plan is the final version will run both in 'live mode' and also with the option of an external TTL trigger. However I am focussing on implementing the live mode first.

 

Regards and thanks,

Dave

 

 

 

Active Participant
rpursley8
Posts: 970

Re: Can you un-register from a Frame Done Event

You can actually just use 'Unregister for Events' to unregister it and then implement the same  'Frame Done' Event to start it up again.

 

Unregister.png

 

 

Reregister.png

 

Randall Pursley
Member
DeltaJ
Posts: 104
0 Kudos

Re: Can you un-register from a Frame Done Event

Hi Randall,

 

I'll give that a try - thank you very much,

 

Regards,

Dave

Member
DeltaJ
Posts: 104
0 Kudos

Re: Can you un-register from a Frame Done Event

That worked thank you:smileyvery-happy: