Hi,
Sharpcap Pro user here (64-bit)
For demonstration purposes, I'd want to be able to automatically save the livestack ("as seen", possibly) as soon as a new frame gets captured and stacked.
The goal here would be to demonstrate how the stack evolves in time as new frames are added, via a small GIF or a "stop-motion" movie.
I know the livestack can already be saved every X minutes, but it's also reset at the same time.
I guess a way to achieve that would be to write a small Python script, but I could not find script examples that use the livestacking object. Would there be any pointers to such scripts I could modify and adapt to my needs?
Thanks!
Automatically saving the livestack as a new frame is stacked
- admin
- Site Admin
- Posts: 13339
- Joined: Sat Feb 11, 2017 3:52 pm
- Location: Vale of the White Horse, UK
- Contact:
Re: Automatically saving the livestack as a new frame is stacked
Hi,
This is the starting point that you need to save the image from the live stacking as seen.
You can monitor the value of
Every second or so to see if it is increased and then save if it has.
Cheers, Robin
This is the starting point that you need to save the image from the live stacking as seen.
Code: Select all
SharpCap.LiveStacking.SaveFrameAsSeen("f:\\file.png")
Code: Select all
SharpCap.LiveStacking.StackedFrames
Cheers, Robin
Re: Automatically saving the livestack as a new frame is stacked
Thank you Robin, I'll give it a go tonight!
Re: Automatically saving the livestack as a new frame is stacked
Here you go:
The script saves each iteration of the stack on the desktop, in a folder named "SharpcapStacks", using a subfolder named after the date and time.
It resets the stack when it is launched (a design choice), but you can disable that behavior by commenting out the SharpCap.LiveStacking.Reset() line.
If possible, I'll try and add a way to automagically create a GIF from the saved images.
Some debug lines are still present (commented out, especially the one that disturbs the observer with a beep each time a new image has been stacked). Please feel free to remove and modify as needed.
The script saves each iteration of the stack on the desktop, in a folder named "SharpcapStacks", using a subfolder named after the date and time.
It resets the stack when it is launched (a design choice), but you can disable that behavior by commenting out the SharpCap.LiveStacking.Reset() line.
If possible, I'll try and add a way to automagically create a GIF from the saved images.
Some debug lines are still present (commented out, especially the one that disturbs the observer with a beep each time a new image has been stacked). Please feel free to remove and modify as needed.
Code: Select all
# Script that saves the stack each time a new frame is stacked
# import winsound
import time
import datetime
from os.path import expanduser
home = expanduser("~")
fileTime = 'stack-{date:%Y-%m-%d_%H_%M_%S}'.format( date=datetime.datetime.now() )
SharpCap.LiveStacking.Reset() # reset the livestack
stackedFrames = SharpCap.LiveStacking.StackedFrames
pathName = home + "\\Desktop\\SharpcapStacks\\" + fileTime + "\\{}.png"
# loop indefinitely
while True:
if SharpCap.LiveStacking.StackedFrames > stackedFrames:
stackedFrames = SharpCap.LiveStacking.StackedFrames
# winsound.Beep(500, 250)
stackFileName = pathName.format(stackedFrames) # add the number of stacked frames to the filename
# print stackFileName
SharpCap.LiveStacking.SaveFrameAsSeen(stackFileName) # save
time.sleep(SharpCap.SelectedCamera.Controls.Exposure.Value/1000) # pause for the duration of the frame capture