Single frame capture framerate optimization

Discussions on extending SharpCap using the built in Python scripting functionality
Post Reply
FlankerOneTwo
Posts: 6
Joined: Sun Feb 25, 2024 6:14 pm

Single frame capture framerate optimization

#1

Post by FlankerOneTwo »

Hi again! Lots of questions from me, sorry!

For the eclipse I am running repeated sequences of single frame captures, stepping through a range of exposure settings. I've noticed that although the video frame preview rate (from an ASI678MC in the test case) is around 23 fps, however when I <set exposure-capture frame-repeat> that the max capture rate that I can achieve is about 3 fps (with short 5 ms exposures). I'm not sure where the time is being lost, whether it's from changing the exposure setting, waiting on file write, or something else? Is SharpCap blocking until each image file is written, and if so is there a format faster than TIFF? If the lost time is from the file write, is there a way to grab a number of exposures quickly without waiting for the write to complete (e.g. frame buffering)? Using CaptureSingleFrameAsync doesn't seem to be any faster.

Thanks again!
User avatar
admin
Site Admin
Posts: 13347
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Single frame capture framerate optimization

#2

Post by admin »

Hi,

capturing as single frames inevitably slows down the frame rate, as there is a lot of extra work going on around each capture. Normally this isn't particularly apparent since it happens around pressing the 'snapshot' button and hitting that more than 2 or so times per second is hard. When you start to script things, you spot the overheads creeping in.

Capturing multiple frames in one go rather than single frames will help lots - the equivalent of pressing 'Start Capture', then selecting say 100 frames as a limit. Even if capturing to TIF, that approach triggers caching of frames to be written and will give a much higher frame rate. What you lose is the ability to be sure that the exposure changes are between the captured frames - your script can poll the SelectedCamera.CapturedFrameCount and change the exposure in response to the count increasing, but not be sure exactly which frame index will get the results of the exposure change).

Code: Select all

# set output format to TIFF, etc
from SharpCap.UI import CaptureLimitType
SharpCap.SelectedCamera.CaptureConfig.CaptureLimitType = CaptureLimitType.FrameLimited
SharpCap.SelectedCamera.CaptureConfig.CaptureLimitCount = 100
SharpCap.SelectedCamera.PrepareToCapture()
SharpCap.SelectedCamera.RunCapture()
# check SharpCap.SelectedCamera.Capturing and CapturedFrameCount periodically, alter exposure as required
 
cheers,

Robin
FlankerOneTwo
Posts: 6
Joined: Sun Feb 25, 2024 6:14 pm

Re: Single frame capture framerate optimization

#3

Post by FlankerOneTwo »

Thanks for the reply, that's kind of what I thought. I'll experiment with that a bit. I don't suppose you have plans to implement an exposure ramp in the capture settings? For instance, instead of just number of frames limit also include for example a starting exposure length and a scale factor for the exposure lengths for each sequential frame in the capture? That kind of exposure bracketing might be an interesting start to doing something like HDR live stacking, which might actually be kind of cool.

Thanks for the help!
User avatar
admin
Site Admin
Posts: 13347
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Single frame capture framerate optimization

#4

Post by admin »

Hi,

right now I'm not planning to add anything built in for the exposure bracketing - I would imaging people solving that through either the sequencer or scripting as you have. Hope that you get some good results with the new approach.

cheers,

Robin
Post Reply