Page 1 of 1

AllSky Capture Script

Posted: Fri Mar 06, 2020 6:54 pm
by admin
I've been working on getting an all sky camera up and running and getting it to record automatically in SharpCap over the last few days. There are some improvements in the very latest version of SharpCap (3.2.6248) which will help AllSky users, including WMV output for much smaller output video files and better reporting of the actual exposure in auto exposure mode for Altair cameras.

To get the actual captures running, I've used the python scripting - here is the current version of my script

Code: Select all

import datetime
import time

SharpCap.SelectedCamera = SharpCap.Cameras.Find(lambda x: x.DeviceName == "ALTAIR290C3(USB2.0)")
SharpCap.SelectedCamera.LoadCaptureProfile('allsky (ALTAIR290C3(USB2.0))')

from SharpCap.UI import CaptureLimitType
SharpCap.SelectedCamera.CaptureConfig.CaptureLimitType = CaptureLimitType.Unlimited

def hour():
	return datetime.datetime.now().hour
	
def exposurems():
	return SharpCap.SelectedCamera.Controls.Exposure.ExposureMs



while True:

	print "waiting for 15:00"
	
	while (hour() < 15):
		time.sleep(1)
		
	print "after 15:00, waiting for >10ms exposure"
	
	count = 0
	
	while (hour() >= 15) | (hour() < 3):
		time.sleep(1)
		if (exposurems() > 10):
			count=count+1
		else:
			count=0
		if (count > 60):
			print "starting capture at " + str(datetime.datetime.now()) + " exposure is " + str(exposurems()) + "ms" 
			SharpCap.SelectedCamera.PrepareToCapture()
			SharpCap.SelectedCamera.RunCapture()
			break
			
	print "waiting until morning"
	
	while (hour()>15) | (hour() < 4):
		time.sleep(1)
			
	print "waiting for <10ms exposure at " + str(datetime.datetime.now())
			
	count = 0
	while (hour() < 9):
		if (exposurems() < 10):
			count=count+1
		else:
			count = 0;
		if (count > 60):
			break;
		time.sleep(1)
	
	print "stopping capture at " + str(datetime.datetime.now()) + " exposure is " + str(exposurems()) + "ms" 
	
	if (SharpCap.SelectedCamera.Capturing):
		SharpCap.SelectedCamera.StopCapture()
	
The script works by monitoring the current exposure of the camera (the camera is put in auto exposure mode) – when the exposure rises above 10 ms for at least 60 continuous seconds after 3 PM, the capturing will start. When the exposure drops again below 10 ms in the morning (again for 60 continuous seconds) the capture is stopped. During the day I find that the camera tends to sit at minimum exposure of 0.24 ms even when overcast – 10 ms seems to correspond with a twilight sky just before stars become visible.

I still have some issues where the auto exposure sometimes become stuck or doesn't report the exposure time correctly, but in general things are working.

Here are the capture settings that I'm currently using

Code: Select all

Output Format=WMV file (Lossy Compression, *.wmv)
Capture Area=1920x1080
Binning=1x1
Pan=0
Tilt=0
Colour Space=RGB24
Temperature=28
Black Level=3
Flip=None
USB Speed=1
Auto Gain with Auto Exposure=Up to 1600
Auto Exp Target=75
Frame Rate Limit=1 every 15 seconds
Analogue Gain=228
Exposure=0.244(Auto)
Timestamp Frames=On
Hue=0
Saturation=128
Contrast=0
Brightness=0
Gamma=100
Extra Controls=On (Slower)
Negative=Off
Colour Tint=713
Colour Temp=5838
Banding Threshold=35
Banding Suppression=0
Apply Flat=None
Subtract Dark=None
#Black Point
Display Black Point=0
#MidTone Point
Display MidTone Point=0.5
#White Point
Display White Point=1
The key points here are having the exposure set to automatic, auto gain enabled with auto exposure up to a maximum of 1600 gain and and RGB colour space which we would normally avoid, but it does enable the WMV output. I have also tweaked the colour settings to give a reasonably neutral colour balance.

Hope this is useful, Robin

Re: AllSky Capture Script

Posted: Sat Aug 14, 2021 5:04 pm
by burke
Hi Robin,

Timely and useful, I'm experimenting with my ZWO 224 fish eye for taking some all sky video.
I am fairly new and have a question about auto gain.
"auto exposure up to a maximum of 1600 gain"
So how do I set the gain limit to 1600 ... and this is probably really stupid, but what units are you referring to? 1600 fps - that does not seem right
The frame rate limits available in auto, start with Maximum then 480 fps, 240 fps etc

Maybe You are referring to limiting exposure? And if so same questions
How?
What units? Seconds, Milliseconds?

Thanks

Darrell

Re: AllSky Capture Script

Posted: Sat Aug 14, 2021 5:26 pm
by admin
Hi Darrell,

some of the settings shown above are specific to Altair branded cameras - for ZWO they will be somewhat different.

What you want to look for are the following settings for ZWO:

* Auto Exp Max Exp MS - this is the maximum exposure (in milliseconds) that auto exposure will use
* Auto Exp Max Gain - this is the maximum gain value that auto exposure will use.

You might set those to perhaps 30000 (30s) and 250 ( a total gain of about 17x for ZWO cameras) as a starting point. It's best to adjust these parameters manually (on a dark, clear night) until you get an image brightness you are happy with under auto-exposure, then save them as a capture profile for later reuse.

cheers,

Robin

Re: AllSky Capture Script

Posted: Sat Aug 14, 2021 6:52 pm
by burke
Perfect!
Adjustments made and saved.
Thanks so much!

Darrell

Re: AllSky Capture Script

Posted: Wed Oct 20, 2021 7:35 am
by hipoh
Hi,

is it true that there is currently no way to use the script with a QHY camera (it is a QHY-5III-485C)?
As far as I know, the QHY does not support autoexposure.

Cheers,
Dieter

Re: AllSky Capture Script

Posted: Wed Oct 20, 2021 1:35 pm
by admin
Hi,

unfortunately you are correct - QHY does not have autoexposure in their SDK.

Depending on how much you want to write using the Python scripting, you may be able to write your own.

* Attach to the FrameCaptured event of the camera - your code will get called ever frame
* Call GetStats() on the Frame property of the event arguments - that will return the frame mean and standard deviation brightness
* Adjust the exposure time (and/or gain) based on the mean frame brightness when required

See viewtopic.php?t=1141 for previous discussion of hooking the frame captured event.

cheers,

Robin

Re: AllSky Capture Script

Posted: Thu Oct 21, 2021 9:10 am
by hipoh
Hi Robin,

thanks for your fast reply!
As I am not a programmer, it will be a too difficult job for me I suppose…

I had the hope that QHY meanwhile did some improvements to their drivers…
So I will stick to my ASI cam, hoping that they can do in „autoexposure mode“.

Cheers, Dieter