Capture and Saving Rapidity

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

Capture and Saving Rapidity

Post by RedArrow78 » Tue May 26, 2020 12:33 pm

Hello everyone,
For an occultation purpose, i would like to take a capture, timestamp it, and save it in a dedicated folder.
I was able to do all this quite easely, but something showed up : The computer associated with my camera is quite slow.
That is the reason why the saving step is really slow (as i have 7Mo pistures with my camera).
I wondered if it is possible to capture a single frame and save it temporarly in the RAM. And once the capture session is over, save all captures in a dedicated folder.
Thank you in advance !
Thibault, From France

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

Re: Capture and Saving Rapidity

Post by admin » Tue May 26, 2020 8:38 pm

Hi,

SharpCap already stores images in RAM in preparation for saving them. If you look in the status bar at the bottom you will see a piece of text along the lines of

Memory: 1 of 218 frames in use

This is telling you that SharpCap is currently using 1 of 218 frames set aside in memory. If you start capturing and the speed of writing to disk cannot keep up then the number of in use frames will increase. SharpCap won't actually drop any frames from the camera until all of the reserved frame memory is used. When you press the stop capture button, SharpCap will spend some time catching up on writing images to disk if necessary. There is no way currently to start another capture until SharpCap has finished catching up on the current capture.

The free version of SharpCap will allow you to use up to 1 GB of memory to store frames before they are written to disk. If you have 8 GB or more of memory then using the pro version of SharpCap will allow you to increase the amount of memory that can be used in this way.

Hope this helps, Robin

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

Re: Capture and Saving Rapidity

Post by RedArrow78 » Wed May 27, 2020 12:14 pm

Thank you for your help.
I undertand. But the fact is that i want to use the script to build a session overnight.
Here is a code that take a picture 10 time, timestamp it, and save it in a dedicated folder as fast as possible. The fact is that with my ZWO ASI294MC, my computer takes more than one second to do so, for each capture !!!....

My goal is to shoot at 2FPS at least.
Here is the code:
import time
import datetime
clr.AddReference("System.Drawing")
today = datetime.datetime.now()
print(time.time())
print(today)
i=0
timetry=1590419100
SharpCap.SelectedCamera.Controls.OutputFormat.Value = "PNG files (*.png)"
if (SharpCap.SelectedCamera.Controls.Exposure.AutoAvailable):
SharpCap.SelectedCamera.Controls.Exposure.Automatic = True
while True and i<10:
if time.time()>timetry:
Name="C:\Users\Thibault\Desktop\Sharpcaptry\capture" + str(i) + ".png"
SharpCap.SelectedCamera.CaptureSingleFrameTo(Name)
timetry=timetry+1
i=i+1

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

Re: Capture and Saving Rapidity

Post by admin » Wed May 27, 2020 7:35 pm

Hi,

By using the call to capture a single frame repeatedly, you are bypassing the caching in memory completely. In order to take advantage of that you should use the scripting colds that start a capture for 10 frames (for example) having previously set the output format to PNG. You will still get 10 PNG files, but they should be captured over 10 consecutive seconds even if they take longer than that to write out fully in the end.

There are some hints that will help you in this direction in this thread

viewtopic.php?t=2025

Hope this helps, Robin

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

Re: Capture and Saving Rapidity

Post by RedArrow78 » Wed May 27, 2020 8:12 pm

Thank you very much Robin !
I figured it out this afternoon and it worked perfectly !

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

Re: Capture and Saving Rapidity

Post by admin » Thu May 28, 2020 6:07 pm

Hi,

Glad to hear you got it working :-)


Cheers, Robin

Post Reply