derosiat2
2015-01-30 05:37:53 UTC
I'm working on a raspberry pi photobooth application. I don't know how to get
the camera to focus at the beginning of the preview process though.
It can show a live preview (really choppy) then grab an image and email you
a copy of it with a watermark. Hopefully you can see it here:
https://github.com/derosiat2/dslr-photobooth
But! The image it grabs is only live view sized not the size I would get if
I did a >>gphoto2 --capture-image-and-download --filename "filename.jpg"
I don't want to go to the command line to capture the image because I think
I'll have to release the camera and then it'll have to reinitialize and
that'll be too slow. The code I'm using looks like this and honestly don't
know what fil and ctx are, I got them from another post in this forum:
#start gphoto specific calls
gp = ctypes.CDLL('libgphoto2.so')
GP_OK = fileNbr = 0
GP_VERSION_VERBOSE = 1
cam = ctypes.c_void_p()
gp.gp_camera_new(ctypes.byref(cam))
ctx = gp.gp_context_new()
fil = ctypes.c_void_p()
gp.gp_file_new(ctypes.byref(fil))
#end gphoto specific calls
#trying to capture full size image, but it only comes out as a preview sized
image
gp.gp_camera_capture(cam, fil, ctx)
cData = ctypes.c_void_p()
cLen = ctypes.c_ulong()
gp.gp_file_get_data_and_size(fil, ctypes.byref(cData), ctypes.byref(cLen))
full_string = ctypes.string_at(cData.value, cLen.value)
full_size = Image.open(StringIO.StringIO(full_string))
mark = Image.open('logo.png')
#This adds a watermark 70% over, 70% down and 30% the size of the image with
1.0 alpha
full_size = watermark.watermark(full_size, mark, (.70, .70), .3, 1.0)
full_size.save('%s.jpg' % email)
--
View this message in context: http://gphoto-software.10949.n7.nabble.com/Full-size-image-capture-autofocus-with-ctypes-in-python-tp15072.html
Sent from the gphoto-user mailing list archive at Nabble.com.
the camera to focus at the beginning of the preview process though.
It can show a live preview (really choppy) then grab an image and email you
a copy of it with a watermark. Hopefully you can see it here:
https://github.com/derosiat2/dslr-photobooth
But! The image it grabs is only live view sized not the size I would get if
I did a >>gphoto2 --capture-image-and-download --filename "filename.jpg"
I don't want to go to the command line to capture the image because I think
I'll have to release the camera and then it'll have to reinitialize and
that'll be too slow. The code I'm using looks like this and honestly don't
know what fil and ctx are, I got them from another post in this forum:
#start gphoto specific calls
gp = ctypes.CDLL('libgphoto2.so')
GP_OK = fileNbr = 0
GP_VERSION_VERBOSE = 1
cam = ctypes.c_void_p()
gp.gp_camera_new(ctypes.byref(cam))
ctx = gp.gp_context_new()
fil = ctypes.c_void_p()
gp.gp_file_new(ctypes.byref(fil))
#end gphoto specific calls
#trying to capture full size image, but it only comes out as a preview sized
image
gp.gp_camera_capture(cam, fil, ctx)
cData = ctypes.c_void_p()
cLen = ctypes.c_ulong()
gp.gp_file_get_data_and_size(fil, ctypes.byref(cData), ctypes.byref(cLen))
full_string = ctypes.string_at(cData.value, cLen.value)
full_size = Image.open(StringIO.StringIO(full_string))
mark = Image.open('logo.png')
#This adds a watermark 70% over, 70% down and 30% the size of the image with
1.0 alpha
full_size = watermark.watermark(full_size, mark, (.70, .70), .3, 1.0)
full_size.save('%s.jpg' % email)
--
View this message in context: http://gphoto-software.10949.n7.nabble.com/Full-size-image-capture-autofocus-with-ctypes-in-python-tp15072.html
Sent from the gphoto-user mailing list archive at Nabble.com.