Page 1 of 1

CaptureSingleFrameTo issue

Posted: Mon Feb 26, 2024 10:06 pm
by stbkaiser
HI
Trying to capture a file to my drive using CaptureSingleFrameTo

Here is the script
SharpCap.SelectedCamera = SharpCap.Cameras [0] # Open the first camera in the Cameras menu and start previewing it
time.sleep(4)
SharpCap.SelectedCamera.Controls.OutputFormat.Value = "TIF files (*.tif)"
SharpCap.SelectedCamera.CaptureSingleFrameTo("d:\shared\test.tif")
SharpCap.SelectedCamera = None # close camera

The problem:
The Sharpcap msg banner says it captured to D:\\shared_est.tif
How would I capture to a sub directory?
Thanks

Re: CaptureSingleFrameTo issue

Posted: Tue Feb 27, 2024 2:21 pm
by admin
Hi,

the '\' is an escape character in python, so you are \t gets you a tab (not sure what \s is). Use double backslash if you want an actual backslash character in the string.

Code: Select all

SharpCap.SelectedCamera.CaptureSingleFrameTo("d:\\shared\\test.tif") 
cheers,

Robin