I have a script that uses SharpCap.SelectedCamera.CaptureSingleFrameTo to capture pictures. Unfortunately I need the picture to be taken from the time that line runs, however I appears the Advanced Capture feature of the software causes the frame to be captured (at least partly) from stored data.
EG If I want a 5 second exposure and issue the capture command the picture could be captured immediately using the last 5 seconds and not the 5 seconds after the command was issued (or it might use the next 5 seconds if a picture has just completed - a little too unpredictable for what I need).
I have looked at the SharpCap.Initialize command (which refers to skipAdvancedCaptureProvider) but, if that is what I need, I need more info as to how to use it. Otherwise - what do I do?
Any insight would be gratefully appreciated.
[running on a beta versions - 2.10.3695
(Also commands copied without copy and paste so forgive any transcription errors)
]
Skip Advanced Capture
- admin
- Site Admin
- Posts: 13339
- Joined: Sat Feb 11, 2017 3:52 pm
- Location: Vale of the White Horse, UK
- Contact:
Re: Skip Advanced Capture
Hi,
I'm afraid that the 'skip advanced capture' option isn't what you're looking for - that initialize call is designed to be called only once by the SharpCap application when setting up and calling it again won't have any good effects. Anyway, that option simple tells SharpCap not to load direct drivers to any camera, so if you did manage to persuade SharpCap to call that with the parameter set to false the first time then you'd get only ASCOM and Directshow cameras being detected...
The behaviour you describe - where the snapshot frame is the previous frame that was captured (ie the one showing on the screen at the moment) applies in 2.10 for exposures longer than 1 second. However, there is a check to see if the camera settings have been unchanged since the time that that previous frame was captured, so if you tweak any of the camera settings (gain, exposure, etc) by a tiny bit you should be able to stop that from happening.
However...
Remember that SharpCap works as a video camera application, and frames are rolling all the time. If you set a 5 second exposure then you will get a new frame arrive every 5 seconds. If you start that at time t=0, then ask for a snapshot at time t=7, the snapshot will be completed at time t=10 and cover the time from t=5 to t=10 (and if you don't do the tweak of adjusting a parameter then your snapshot would cover the time from t=0 to t=5).
If you really want the snapshot to cover a particular section of time, then the best thing to do is to set the exposure to a lower value (0.01s) then set it to 5s when you want the snapshot to start, then grab a single frame, then set it back.
Hope this helps,
Robin
I'm afraid that the 'skip advanced capture' option isn't what you're looking for - that initialize call is designed to be called only once by the SharpCap application when setting up and calling it again won't have any good effects. Anyway, that option simple tells SharpCap not to load direct drivers to any camera, so if you did manage to persuade SharpCap to call that with the parameter set to false the first time then you'd get only ASCOM and Directshow cameras being detected...
The behaviour you describe - where the snapshot frame is the previous frame that was captured (ie the one showing on the screen at the moment) applies in 2.10 for exposures longer than 1 second. However, there is a check to see if the camera settings have been unchanged since the time that that previous frame was captured, so if you tweak any of the camera settings (gain, exposure, etc) by a tiny bit you should be able to stop that from happening.
However...
Remember that SharpCap works as a video camera application, and frames are rolling all the time. If you set a 5 second exposure then you will get a new frame arrive every 5 seconds. If you start that at time t=0, then ask for a snapshot at time t=7, the snapshot will be completed at time t=10 and cover the time from t=5 to t=10 (and if you don't do the tweak of adjusting a parameter then your snapshot would cover the time from t=0 to t=5).
If you really want the snapshot to cover a particular section of time, then the best thing to do is to set the exposure to a lower value (0.01s) then set it to 5s when you want the snapshot to start, then grab a single frame, then set it back.
Hope this helps,
Robin
Re: Skip Advanced Capture
Helped a lot. Many thanks.
----
The problem here is that I need to capture a frame from the time the "capture frame" command is given. And not use any previously buffered image data.
Here are my utilitarian code snippets. For anyone needing a jumping off point be aware I know relatively little of SharpCap/python.
Initialise stage:
If useful to anyone, good luck.
----
The problem here is that I need to capture a frame from the time the "capture frame" command is given. And not use any previously buffered image data.
Here are my utilitarian code snippets. For anyone needing a jumping off point be aware I know relatively little of SharpCap/python.
Initialise stage:
- current_exposure = SharpCap.SelectedCamera.Controls.Exposure.ExposureMs
current_gain = SharpCap.SelectedCamera.Controls.Gain.Value
def capt_now(): # Probably don't need to change both gain and exposure- SharpCap.SelectedCamera.Controls.Exposure.ExposureMs = 100 # set arbitrary value 0.1 sec
SharpCap.SelectedCamera.Controls.Gain.Value = 10
SharpCap.SelectedCamera.CaptureSingleFrameTo(cap_lib + "capture_start_bucket.png") # get those values read
SharpCap.SelectedCamera.Controls.Exposure.ExposureMs = current_exposure # restore values
SharpCap.SelectedCamera.Controls.Gain.Value = current_gain
- SharpCap.SelectedCamera.Controls.Exposure.ExposureMs = 100 # set arbitrary value 0.1 sec
- capt_now()
SharpCap.SelectedCamera.CaptureSingleFrameTo(cap_lib + "im" + time.time().ToString() + "a.png")
while SharpCap.SelectedCamera.Capturing: # otherwise next call to capt_now will cause saving of truncated frame- time.sleep(.01)
If useful to anyone, good luck.
Re: Skip Advanced Capture
Robin. You provided advice last year on how to start a frame capture from the actual time it is requested (IE not from the buffer). Basically this was by resetting the camera. I noticed some activity in this area and wondered if you had added a more sophisticated option. Grateful for an update.
- admin
- Site Admin
- Posts: 13339
- Joined: Sat Feb 11, 2017 3:52 pm
- Location: Vale of the White Horse, UK
- Contact:
Re: Skip Advanced Capture
Hi,
there is no real change on that at the moment - in a future version (3.3 I hope) there will be proper support for still capture which means that the camera will no longer need to be running like a video camera all the time and you will be able to press (or script) a single capture.
cheers,
Robin
there is no real change on that at the moment - in a future version (3.3 I hope) there will be proper support for still capture which means that the camera will no longer need to be running like a video camera all the time and you will be able to press (or script) a single capture.
cheers,
Robin
Re: Skip Advanced Capture
Hi,
are you still on track for this feature (quoting you below and at top of this "mail chain")?
... in a future version (3.3 I hope) there will be proper support for still capture which means that the camera will no longer need to be running like a video camera all the time and you will be able to press (or script) a single capture. ...
Also, any new features I might have missed to do with scripting captures?
Many thanks.
Peter
are you still on track for this feature (quoting you below and at top of this "mail chain")?
... in a future version (3.3 I hope) there will be proper support for still capture which means that the camera will no longer need to be running like a video camera all the time and you will be able to press (or script) a single capture. ...
Also, any new features I might have missed to do with scripting captures?
Many thanks.
Peter
- admin
- Site Admin
- Posts: 13339
- Joined: Sat Feb 11, 2017 3:52 pm
- Location: Vale of the White Horse, UK
- Contact:
Re: Skip Advanced Capture
Hi,
Sequencing and the still mode will be the main features for version 3.3. If you have a look across in the announcements forum you will see I posted a screenshot of the current prototype of the sequencing tool yesterday.
Cheers, Robin
Sequencing and the still mode will be the main features for version 3.3. If you have a look across in the announcements forum you will see I posted a screenshot of the current prototype of the sequencing tool yesterday.
Cheers, Robin