Timestamping function, frame limit and auto exposure

Discussions on extending SharpCap using the built in Python scripting functionality
Post Reply
RedArrow78
Posts: 7
Joined: Tue May 26, 2020 9:20 am

Timestamping function, frame limit and auto exposure

Post by RedArrow78 » Fri May 29, 2020 1:48 pm

Hello there,
I have tree different question concerning scripting.
I would like to set through the script the timestamped frame on.I didn' find any function for that.
for camera controls this time, i'm not able to set a frame limit in my script.
And finally, for the exposure, i'm able to set the auto esposure mode off, and set manually an expousure time. But, as soon as i begin a capture the auto exposure mode switch back on ! I don' get it.
Here is my code :
import time
import os
SharpCap.Settings.CaptureFolder = "C:\Users\share\Documents\Thibault SharpCap" #assign the folder where captures are saved
SharpCap.SelectedCamera = SharpCap.Cameras.Find( lambda x:x.DeviceName == "ZWO ASI294MC") #Connect the camera to the software
SharpCap.SelectedCamera.Controls.OutputFormat.Value = "TIFF files (*.tif)" #set the output format of capture
SharpCap.SelectedCamera.Controls.Exposure.Automatic = False #Set the exposure to manual (bollean)
SharpCap.SelectedCamera.Controls.Exposure.Value=0.5 #set the exposure time (in ms)
SharpCap.SelectedCamera.Controls.Gain.Automatic = False #Set the gain setting to manual (bollean)
SharpCap.SelectedCamera.Controls.Gain.Value = 25 # Set a specific gain value
if (SharpCap.SelectedCamera.Controls.Exposure.AutoAvailable):
SharpCap.SelectedCamera.Controls.Exposure.Automatic = True
if True:
SharpCap.SelectedCamera.PrepareToCapture()
SharpCap.SelectedCamera.RunCapture()
time.sleep(10)
SharpCap.SelectedCamera.StopCapture()
time.sleep(15)


Thank you very much for your help

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

Re: Timestamping function, frame limit and auto exposure

Post by admin » Fri May 29, 2020 3:20 pm

Hi,

you can find this in the controls collection of the camera

Code: Select all

>>> print SharpCap.SelectedCamera.Controls
List[Control]([<SharpCap.Models.Control object at 0x000000000000006C [Debayer Preview]>, <SharpCap.Models.Control object at 
0x000000000000006D [Output Format]>, <SharpCap.Models.ColourSpaceControl object at 0x000000000000006E [Colour Space]>, 
<SharpCap.Models.Control object at 0x000000000000006F [Resolution]>, <SharpCap.Models.Control object at 0x0000000000000070 [Pan]>, 
<SharpCap.Models.Control object at 0x0000000000000071 [Tilt]>, <SharpCap.Models.Control object at 0x0000000000000072 [Frame Rate Limit]>, 
<SharpCap.Models.Control object at 0x0000000000000073 [Gain]>, <SharpCap.Models.ExposureControl object at 0x0000000000000074 [Exposure]>, 
[u]<SharpCap.Models.Control object at 0x0000000000000075 [Timestamp Frames]>[/u], <SharpCap.Models.Control object at 0x0000000000000076 
[Color Enhancement]>, <SharpCap.Models.Control object at 0x0000000000000077 [Highlight reduction]>, <SharpCap.Models.Control object at 
0x0000000000000078 [Denoise]>, <SharpCap.Models.Control object at 0x0000000000000079 [Brightness]>, <SharpCap.Models.Control object at 
0x000000000000007A [Contrast]>, <SharpCap.Models.Control object at 0x000000000000007B [Hue]>, <SharpCap.Models.Control object at 
0x000000000000007C [Saturation]>, <SharpCap.Models.Control object at 0x000000000000007D [Sharpness]>, <SharpCap.Models.Control object at 
0x000000000000007E [Gamma]>, <SharpCap.Models.Control object at 0x000000000000007F [White Bal (B)]>, <SharpCap.Models.Control object at 
0x0000000000000080 [White Bal (G)]>, <SharpCap.Models.Control object at 0x0000000000000081 [White Bal (R)]>, <SharpCap.Models.Control object 
at 0x0000000000000082 [Temperature]>, <SharpCap.Models.Control object at 0x0000000000000083 [Temperature Preset]>, <SharpCap.Models.Control
 object at 0x0000000000000084 [Auto-Preset]>, <SharpCap.Models.Control object at 0x0000000000000085 [WhiteBalance Mode]>, 
 <SharpCap.Models.Control object at 0x0000000000000086 [Auto]>, <SharpCap.Models.Control object at 0x0000000000000087 [Banding Threshold]>, 
 <SharpCap.Models.Control object at 0x0000000000000088 [Banding Suppression]>, <SharpCap.Models.Control object at 0x0000000000000089 [Apply 
 Flat]>, <SharpCap.Models.Control object at 0x000000000000008A [Subtract Dark]>, <SharpCap.Models.Control object at 0x000000000000008B 
 [Display Black Point]>, <SharpCap.Models.Control object at 0x000000000000008C [Display MidTone Point]>, <SharpCap.Models.Control object at 
 0x000000000000008D [Display White Point]>, <SharpCap.Models.Control object at 0x000000000000008E [Notes]>, <SharpCap.Models.HardwareControl
  object at 0x000000000000008F [Manual Filter Wheel]>, <SharpCap.Models.HardwareControl object at 0x0000000000000090 [ASCOM Simulator 
  Focuser Driver]>, <SharpCap.Models.Control object at 0x0000000000000091 [Mount]>])
  
>>> 
You will have to search the control by name and then assign its value to true.

Hope this helps, Robin

RedArrow78
Posts: 7
Joined: Tue May 26, 2020 9:20 am

Re: Timestamping function, frame limit and auto exposure

Post by RedArrow78 » Wed Jun 03, 2020 8:57 am

Hi, thank you for your help.
But i didn't understand what you're trying to say.
Indeed, my sharpCap doesn't know the attribute 'Models'. And with SharpCap.SelectedCamera.Controls., I don't have the frame rate limit and timestamping mode settings in the list

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

Re: Timestamping function, frame limit and auto exposure

Post by admin » Wed Jun 03, 2020 6:44 pm

Hi,

Can you let me know what version of SharpCap you are using and also what camera you are working with? In the most recent versions of SharpCap, those control should be available for every camera, although their availability was more limited in older versions.

Cheers, Robin

Post Reply