Hi,
I am trying to save a still on my PC from the Arducam 5MP Plus OV5642 connected to a Raspberry Pico. The camera works fine and when I use HostApp.exe I can capture with no problems. Now I am trying to save a still on my computer using Python. So far I can communicate, and send the trigger signal to capture, then I can see the buffer coming back in hex, but I am having troubles formatting it properly. This is the code I have so far, and bellow the current error. Thanks for any help!
import serial
from binascii import unhexlify
s = serial.Serial('COM9', 115200)
# Set resolution
command = "06"
command = unhexlify(command)
s.write(command)
# Grab still
command = "10"
command = unhexlify(command)
s.write(command)
currByte = b""
buffer = []
while True:
if s.isOpen():
line = s.readline().strip()
print(line)
currByte = unhexlify(b'0' + line)
s.close()
Traceback (most recent call last):
File "E:/envs/camcontrol/camcontrol.py", line 23, in <module>
currByte = unhexlify(b'0' + line)
binascii.Error: Odd-length string
b'\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x01\x00\x00\x00\x00\x00\x00\xff\xdb\x00C\x00\x04\x03\x03\x04\x03\x03\x04\x04\x03\x04\x05\x04\x04\x05\x06'
Process finished with exit code 1