Ccycob
- Joined Jan 1, 2022
- 8 best answers
@cycob @jakaskerl Is there any update on the same? I am trying Camera Module 3 and high resolution camera. Which orientation should be the camera attached? Is there any additional need of camera driver?
- Best Answerset by cycob
Hi @cycob
I think it should be possible. Write to support@luxonis.com, they'll know more.Thanks,
Jaka- Best Answerset by jakaskerl
Hi @jakaskerl @cycob
I finally tested the relationship between lens position (0-255) and distance to object (cm) to set the auto focus range with cm values. As expected, with increased distance from camera to object, the differences in optimal lens position values decrease. Also it seems like a lens position of 120 is already more or less focused to infinity. When using default auto focus, the minimum lens position was 120 in my tests, even for objects with a distance of > 3 m to the camera.
I am now using the following code to set the auto focus range with user input values in cm:
parser = argparse.ArgumentParser() parser.add_argument("-af", "--af_range", nargs=2, type=int, help="set auto focus range in cm (min distance, max distance)", metavar=("cm_min", "cm_max")) args = parser.parse_args() if args.af_range: xin_ctrl = pipeline.create(dai.node.XLinkIn) xin_ctrl.setStreamName("control") xin_ctrl.out.link(cam_rgb.inputControl) def set_focus_range(): """Convert closest cm values to lens position values and set auto focus range.""" cm_lenspos_dict = { 6: 250, 8: 220, 10: 190, 12: 170, 14: 160, 16: 150, 20: 140, 25: 135, 30: 130, 40: 125, 60: 120 } closest_cm_min = min(cm_lenspos_dict.keys(), key=lambda k: abs(k - args.af_range[0])) closest_cm_max = min(cm_lenspos_dict.keys(), key=lambda k: abs(k - args.af_range[1])) lenspos_min = cm_lenspos_dict[closest_cm_max] # minimum lens position = 0 (infinity) lenspos_max = cm_lenspos_dict[closest_cm_min] # maximum lens position = 255 (macro) af_ctrl = dai.CameraControl().setAutoFocusLensRange(lenspos_min, lenspos_max) q_ctrl.send(af_ctrl) with dai.Device(pipeline, maxUsbSpeed=dai.UsbSpeed.HIGH) as device: if args.af_range: q_ctrl = device.getInputQueue(name="control") set_focus_range()
Please let me know if you have any recommendations regarding optimization of this approach!
Hi @cycob
According to this doc, RPI5 can output a maximum of 1600mA across all ports shared if you use a 5A power supply. These spikes you see are expected and will cause the OAK to brownout, crashing the device and (potentially - bad power supply) the RPI as well.That's why we use the https://shop.luxonis.com/collections/accessories/products/oak-y-adapter
Thanks,
Jaka