I have the UC444 dual camera adapter and two UC599 Rev A ov9281 sensors running on a Pi 3A board. I’m using a modified python script to save two jpg images on a keypress My issue is that I cannot get both cameras to respond to my manual exposure and gain register settings. Current code below;
switch_camera(‘B’)
camera = arducam.mipi_camera()
print(“Open camera…”)
camera.init_camera()
print(“Setting the cameras…”)
fmt = init_all_camera(camera, 1280, 720)
set_controls(camera)
time.sleep(2)
switch_camera(‘A’)
print(“Open camera…”)
print(“Setting the cameras…”)
set_controls(camera)
input(“Ready, press Enter”)
switch_camera(“B”)
frame = camera.capture(encoding = ‘jpeg’)
frame.as_array.tofile(Path1 + Left %r)
r += 1
del frame
switch_camera(‘A’)
time.sleep(1)
frame = camera.capture(encoding = ‘jpeg’)
frame.as_array.tofile(Path1 + Right %i) #index += 1
i += 1
del frame
print(“Close camera…”)
camera.close_camera()
Only one of the cameras will respond to the settings. If I switch the order of which camera fires first, it seems like only one camera will capture twice. I have tried various ways, and I’ve had success working with just a single sensor connected directly to the Pi. Should calling set_controls change setting on both cameras? Any help on this would much appreciated.
I pulled a fresh copy of the github libary about a week ago.
I thought that is what I am doing in this code below;
if name == “main”:
try:
Open the first channel of I2c
switch_camera(‘B’)
camera = arducam.mipi_camera()
print(“Open camera…”)
camera.init_camera()
print(“Setting the cameras…”)
fmt = init_all_camera(camera, 1280, 720)
set_controls(camera)
time.sleep(2)
switch_camera(‘A’)
print(“Open camera…”)
print(“Setting the cameras…”)
set_controls(camera)
Camera A and B are already defined with i2c addresses. Is this what you mean?
I have also tried set_controls after switch_camera() as I’m saving each image. This does not work either but also would not be practical as it results in a 3 second delay between images.
Also, I have been experimenting and protyping a few different methods of using the 9281 sensor, and I am have trouble finding some explanation on using the register settings. Is it possible to provide me with a datasheet or something with a list of register setting and their uses?
For my application, I need the to save the photos in in as quick succession as is possible. Is there a way for me to change the base exposure and gain settings of the 9281 sensor, so then I don’t have to call set_controls and have a large delay between images?
Also, as I mentioned above, is there some way for me to find an explanation on all the register settings for the UC599 OV9281.
Great to hear it can works normally. In fact, you only need to call the control parameter setting API once, and you can always take pictures later. Just like this I attached for you.
This is what I’m using to save dual images after a keypress.
if name == “main”:
try:
Open the first channel of I2c
switch_camera(‘A’)
camera = arducam.mipi_camera()
print(“Open camera…”)
camera.init_camera()
print(“Setting the resolution…”)
fmt = init_all_camera(camera, 1920, 1080)
index = ord(‘B’)
switch_camera(chr(index))
camera.set_control(v4l2.V4L2_CID_EXPOSURE, 2050)
camera.set_control(v4l2.V4L2_CID_GAIN, 01)
time.sleep(2)
index = ord(‘A’)
switch_camera(chr(index))
camera.set_control(v4l2.V4L2_CID_EXPOSURE, 2050)
camera.set_control(v4l2.V4L2_CID_GAIN, 01)
time.sleep(2)
while 1:
raw_input(“Ready, press Enter”)
j = 1
while j != 3:
if index == 66:
Pic = IR
a = i
i += 1
else:
print(“No”)
Pic = Red
a = r
r += 1
frame = camera.capture(encoding = ‘jpeg’)
switch_camera(chr(index))
frame.as_array.tofile(Path1 + Pic %a)
index += 1
j += 1
time.sleep(0.2)
if index > ord(‘B’):
index = ord(‘A’)
Release memory
del frame
print(“Close camera…”)
camera.close_camera()
except Exception as e:
print(e)
The code works pretty well. On the first loop it saves one of the cameras twice, but I’m sure thats fixable.
Unless there is a small sleep in there, one of the cameras can capture a split image.
Next, I intend to use a gpio interrupt to capture instead of a keypress. Actually, I have a question about the pin usage, but I will start a new thread for that, for clarity.
Actually, someone has already asked about the pinout on the UC444, so can I just clarify that I can use 3v3 power, and GPIO 14 & 15 (board # 8 and 10)?
You mention camera led pin, but I cannot see wich exact pin that is?