QHY camera sometimes not exposing correctly.

A place to report problems and bugs in SharpCap
Forum rules


If you have a problem or question, please check the FAQ to see if it already has an answer : https://www.sharpcap.co.uk/sharpcap-faqs

Please also read about Troubleshooting USB Issues before posting.

*** Please do not post license keys - please report any problems with licensing to 'admin' by private message ***

Please include the following details in any bug report:

* Version of SharpCap
* Camera and other hardware being user
* Operating system version
* Contents of the SharpCap log after the problem has occurred.
[If SharpCap crashes, please send the bug report when prompted instead of including the log]
Post Reply
3ricJohanson
Posts: 13
Joined: Wed Jun 03, 2020 9:02 pm

QHY camera sometimes not exposing correctly.

#1

Post by 3ricJohanson »

I'm scripting many exposures at different exposure lengths -- and I keep running into this problem where my exposures end up wrong. I finally have some clear methods to reproduce this, and some examples.

In short, sometimes when I change exposure via SharpCap.SelectedCamera.Controls.Exposure.Value it doesn't.. really take effect right away. Sometimes it takes a few captures. Sometimes many. Sometimes it's applied right way.

I've attached a script which changes the exposure, takes some photos, then repeats this. Of note, the CameraSettings.txt file always shows the correct exposure, so maybe this is a bug with the QHY driver or something?

I've attached the following:

1. The reference script I'm using for reproducing this problem.
2. The log file from the system while it's running. (hmm, this is too large for the forum, so putting on dropbox)
3. The min/max/mean values from the set of images taken from this script. All shots taken with lenscap on. You can use any tool you like to measure the values in the images, but I used imagemagick here.

Expected result: All shots with the same exposure would have the ~same pixel readings.

Actual result: Often, the camera uses the wrong exposure from the last capture, as show from the pixel min/max/mean values (see "Max" values as it relates to the actual exposure)

Sharpcap verbose log file: https://www.dropbox.com/s/r09r84ag9zpsy ... 6.log?dl=0

I'm using a QHY128C, latest drivers, and I think the latest Sharpcap. I have the "pro" version.
Attachments
get_fits_stats-batch.txt
(649 Bytes) Downloaded 92 times
reproduce_capture_bug.txt
(2.84 KiB) Downloaded 92 times
results.csv
(3.2 KiB) Downloaded 84 times
User avatar
admin
Site Admin
Posts: 13173
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: QHY camera sometimes not exposing correctly.

#2

Post by admin »

Hi,

The fact that changes in exposure (or other image settings for that matter) aren't immediately apparent in the next frame is pretty much expected for cameras running in video mode. Consider that there will almost certainly be a frame in progress on the camera that won't be affected by the change that has just been made perhaps another frame that has been captured is and is now being downloaded over USB, and potentially other frame being processed by the QHY software that haven't yet been delivered to SharpCap.

I deal with this in the sensor analysis code by waiting for up to 5 frames after changing a camera parameter before trusting that the changes reflected in the image that is being analysed. The number of frames is reduced (to 3 from memory) as the exposure rises to 1 second and beyond.

You may find that your qhy camera has a setting on the right-hand side labelled 'force still mode' – if it does, try turning this on. That changes the camera from video mode where it captured frames as quickly as it can send them to SharpCap to still mode where each frame is only captured on command from the application. It's likely that making this change will at least reduce the number of frames that you have to wait before an alteration to the image appears. Note that in this mode, SharpCap still runs the camera in a loop requesting frames all the time, but each frame is explicitly started from the SharpCap side.

Hope this helps, Robin
3ricJohanson
Posts: 13
Joined: Wed Jun 03, 2020 9:02 pm

Re: QHY camera sometimes not exposing correctly.

#3

Post by 3ricJohanson »

Thank you, this makes sense. I will play around with this "still" mode -- it seems to work for capturing, but yes, it is much slower.

Is there some method I can use to ensure the correct settings are applied? I'm using automation for capturing specific frames so I need to ensure the settings are applied correctly (offset, gain, exposure, etc,etc)

- Allowing N time or N frames to pass, based on buffer sizes/frame sizes?
- Restarting the camera interface (eg: would stop/start preview do this? or even RestartPreview?)
- unselecting and reselecting the camera?
- More major like killing the sharpcap process and launching it again?

Do I need to be previewing in order to capture? Would just disabling preview and triggering capture work out better?

Thanks for any ideas,
-3ric
User avatar
admin
Site Admin
Posts: 13173
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: QHY camera sometimes not exposing correctly.

#4

Post by admin »

Hi,

In my experience waiting for five frames seems to be enough for changes to take effect. Stopping/starting or restarting the preview should also make sure that the first frame that arrives after the restart has the correct settings. You shouldn't need to go as far as closing the camera or closing SharpCap :-)

SharpCap can only capture frames while preview is active, so there's nothing to be gained by trying to disable that.

Hope this helps, Robin
3ricJohanson
Posts: 13
Joined: Wed Jun 03, 2020 9:02 pm

Re: QHY camera sometimes not exposing correctly.

#5

Post by 3ricJohanson »

I just testing RestartPreview after changing the exposure. I'm still getting several frames (1 to 3) with the old settings after doing this. Any other ideas for workarounds?

I'm hesitant to use this 5 throwaway frames method because some of my exposures are quite long, and I'm trying to capture milkyway shots with a moving sky -- so blanking (interframe) periods matter to me.
3ricJohanson
Posts: 13
Joined: Wed Jun 03, 2020 9:02 pm

Re: QHY camera sometimes not exposing correctly.

#6

Post by 3ricJohanson »

An update: I tried calling "RestartPreview", and had "force still mode" turn on and it's still holding on to the old frame settings.
3ricJohanson
Posts: 13
Joined: Wed Jun 03, 2020 9:02 pm

Re: QHY camera sometimes not exposing correctly.

#7

Post by 3ricJohanson »

Deeper down the rabbit hole:

I tried bigger guns:

SharpCap.SelectedCamera = None
SharpCap.SelectedCamera = SharpCap.Cameras[0]

Between each setting change, and it still didn't work. :(

I'm out of ideas -- it seems to just really love to hang on to the last setting change.
User avatar
admin
Site Admin
Posts: 13173
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: QHY camera sometimes not exposing correctly.

#8

Post by admin »

Hi,

Some control changes forced the preview to restart anyway. For anything changing the size of the image such as resolution or binning changes or anything changing the bit depth of the image causes this to happen. You could try changing one of these controls like binning and then changing it back again. It may be that the request for an image at a different resolution will be enough to flush any cached images out of whatever bits of code they are hiding in.

SharpCap 3.3 will have a full still mode where images will only be captured in response to requests either via UI or scripting to take a snapshot. Hopefully this will resolve this sort of problem as you would be able to set the camera settings and then request an image. Unfortunately this isn't even in alpha release yet.

Cheers, Robin
Post Reply