Anomaly with RestartPreview command

Discussions on extending SharpCap using the built in Python scripting functionality
Post Reply
SteveJP
Posts: 38
Joined: Sat Apr 28, 2018 8:35 am
Location: Melbourne, Australia

Anomaly with RestartPreview command

#1

Post by SteveJP »

Hi,

I am experiencing an anomaly when using the "SharpCap.SelectedCamera.RestartPreview()" command.

I have a script that moves the mount every once in a while for dithering purposes, but of course the previews continue to run. Whilst I wait until the mount has stopped moving before grabbing the frame with "SharpCap.SelectedCamera.CaptureSingleFrame()", the frame is blured because the capture has continued whilst the mount was moving.

My solution to this is to use "SharpCap.SelectedCamera.RestartPreview()" when the mount has stopped moving so the blurred frame is effectively discarded, but the RestartPreview command has some weird side effects. Most notably, in the frame caputured after the restart, the colour balance is upset and there are other changes in the image.

It maybe that the restart command is re-initialising the camera or similar, rather than just ditching the current capture. Does that make sense?
My actual script has too many dependancies to make posting it here viable, but the effect can also be seen by invoking the "SharpCap.SelectedCamera.RestartPreview()" manually in the IronPython Console window whilst a preview is in progress. (I've set up my camera pointing at a daytime scene with a very dark filter to make 5 to 10 second exposures practical.) If the restart command is executed whilst captures are running, every few frames the displayed image is corrupted.

I'm using an OSC ASI178MC capturing to PNG files with SharpCap 3.2.

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

Re: Anomaly with RestartPreview command

#2

Post by admin »

Hi Steve,

for now I'd suggest looking for a workaround to find an alternative way of achieving your goal without using the restart preview option. For instance you might try doubling the exposure value (which should cause the current frame to be dropped in a new frame to be started) and then setting it back to the normal target value. Another option might be to use the pause functionality to stop the next frame from being saved.

Hope this is helpful, Robin
SteveJP
Posts: 38
Joined: Sat Apr 28, 2018 8:35 am
Location: Melbourne, Australia

Re: Anomaly with RestartPreview command

#3

Post by SteveJP »

admin wrote: Sun Dec 23, 2018 8:27 pm Hi Steve,

for now I'd suggest looking for a workaround to find an alternative way of achieving your goal without using the restart preview option. For instance you might try doubling the exposure value (which should cause the current frame to be dropped in a new frame to be started) and then setting it back to the normal target value. Another option might be to use the pause functionality to stop the next frame from being saved.

Hope this is helpful, Robin
Hi Robin,
I had implemented a delay after the movement stops before the next "SharpCap.SelectedCamera.CaptureSingleFrame()", so I increased this to greater than the exposure time which means I don't capture the blurred frame. Main issue is that it wastes a lot of time, especially if you want to dither after every frame. I might try changing the exposure as you suggest.
Many thanks
Cheers Steve
SteveJP
Posts: 38
Joined: Sat Apr 28, 2018 8:35 am
Location: Melbourne, Australia

Re: Anomaly with RestartPreview command

#4

Post by SteveJP »

admin wrote: Sun Dec 23, 2018 8:27 pm Hi Steve,

for now I'd suggest looking for a workaround to find an alternative way of achieving your goal without using the restart preview option. For instance you might try doubling the exposure value (which should cause the current frame to be dropped in a new frame to be started) and then setting it back to the normal target value. Another option might be to use the pause functionality to stop the next frame from being saved.

Hope this is helpful, Robin
Robin, setting the exposure as suggested works like a charm.
Thanks
User avatar
admin
Site Admin
Posts: 13125
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Anomaly with RestartPreview command

#5

Post by admin »

Hi Steve,

that's good to hear I thought that would work because I spent a lot of time trying to make sure that when the user tweaks the exposure value a new frame with a new exposure started as soon as possible (i.e. cancelling any frame currently in progress).

Cheers, Robin
Post Reply