RAW photo shooting
SvenBBB last edited by ccc
First post here, so be easy on me ;)
I searched the forum for an answer for my question but found none. If the answer is here, my inexperience with the forum could be the reason for not finding it.
I have script for shooting photo’s using objc_util. I copy pasted the heck out of a script but this script makes jpeg files (Thank you for writing this already amazing piece of code!). So compressed. If I want to shoot RAW, what should I do?
This is the photo shooting part of the script:
def take_photo_now(filename = fileName): session = C('AVCaptureSession').new().autorelease() session.sessionPreset = 'AVCaptureSessionPresetPhoto' device = C('AVCaptureDevice').defaultDeviceWithMediaType_('vide') device_input = C('AVCaptureDeviceInput').deviceInputWithDevice_error_(device, None) session.addInput_(device_input) image_output = C('AVCaptureStillImageOutput').new().autorelease() session.addOutput_(image_output) session.startRunning() # NOTE: You may need to adjust this to wait for the camera to be ready (use a higher number if you see black photos): time.sleep(0.1) def handler_func(_block, _buffer, _err): buffer = ObjCInstance(_buffer) img_data = C('AVCaptureStillImageOutput').jpegStillImageNSDataRepresentation_(buffer) img_data.writeToFile_atomically_(filename, True) e.set() video_connection = None for connection in image_output.connections(): for port in connection.inputPorts(): if str(port.mediaType()) == 'vide': video_connection = connection break if video_connection: break e = threading.Event() handler = ObjCBlock(handler_func, restype=None, argtypes=[c_void_p, c_void_p, c_void_p]) retain_global(handler) image_output.captureStillImageAsynchronouslyFromConnection_completionHandler_(video_connection, handler) e.wait()
Thank you in advance!!!
JonB last edited by
You need to use AVCapturePhotoOutput instead of AVCaptureStillImageOutput to get raw output. There are some other changes needed as well, you will have to read the docs or examples that go along with that class.