Enable / disable autofocus on imx179 using python cv2

  1. Where did you get the camera module(s)?
    Official provider for Italy: Robotics-3D

  2. Model number of the product(s)?
    imx179,
    https://www.arducam.com/product/8mp-imx179-autofocus-usb-camera-module-with-single-microphone-for-windows-linux-android-and-mac-os/

  3. What hardware/platform were you working on?
    PC desktop - Win11

  4. Instructions you have followed. (link/manual/etc.)
    i.e.
    Focus and FPS settings in opencv python - #2 by crackwitz - Python - OpenCV

  5. Problems you were having?
    I want to enable/disable programmatically the autofocus of camera using opencv, but if I try to set autofocus property to 1 and after read back, the camera return always 0
    h_cam.set(cv2.CAP_PROP_AUTOFOCUS, 1)
    value = h_cam.get(cv2.CAP_PROP_AUTOFOCUS) <— return always 0 after a set to 1

  6. The dmesg log from your hardware?

  1. Troubleshooting attempts you’ve made?
  1. What help do you need?
    What is the correct procedure in python and cv2 to enable/disable autofocus?

Hi,
You can refer to the link below:
https://docs.arducam.com/UVC-Camera/Appilcation-Note/OpenCV-Python-GStreamer-on-linux/#how-to-achieve-manual-focus-of-autofocus-camera-using-opencv