Setting exposure time on OV7251 in current Raspbian Bullseye

We can’t seem to set the exposure on our OV7251 camera on a Raspberry Pi Zero 2 or Raspberry Pi 3B.

Things we’ve tried:

  • v4l2-ctl -d /dev/video0 --set-ctrl exposure=1700
    Result: v4l2-ctl will report the correct exposure, but images taken through the v4l2-ctl command line tool don’t change. They have the same low intensity regardless of the exposure we set.

  • using openCV in Python, we’ve tried

    ITSY=1000
    import cv2
    cap = cv2.VideoCapture(0)
    cap = cap.set(cv2.CAP_PROP_EXPOSURE, ITSY)
    ret, frame = cap.read()

    But the images we get all have the same intensity regardless of what we set for ITSY.
    BTW: cap.get(cv2.CAP_PROP_EXPOSURE) returns -1 before and after trying to set the exposure time.

  • using arducam_mipicamera:

    import arducam_mipicamera as arducam
    camera = arducam.mipi_camera()

    this crashes before we can even try to set the exposure. The error is:
    init_camera: Unexpected result.

    BTW: The example script for arducam_mipicamera, https://github.com/ArduCAM/MIPI_Camera/blob/master/RPI/python/preview.py
    uses the Python package v4l2 which is incompatible with requires Python 2.7 which in turn has been
    unmaintained for over two years. We suspect that arducam_mipicamera is also incompatible with Python 3 and that may be the reason for the error.

  • using arducamstill, compiled from the git project:
    Simply running the programm gives us the rather uninformative output:

    Open camera…
    init camera status = 4099

To summarize: The two ways to effectively take images we have found were a) through the v4l2-ctl utility and b) through OpenCV, neither of which seem to set or respect the exposure setting.

What gives? What else can we try?

Hello,
Welcome to our community. Sorry to hear you have happened so many issue when using the camera. Don’t worry and I will try my best to help you.
About the camera driver, with the libcamera has released and RPI has desert the legacy camera framework and use the libcamera framewrok, so our arducam_mipicamera lib which is based on legacy camera framework has been deserted. So The libcamera is your best choice. Please download the latest bullseye version system here https://downloads.raspberrypi.org/raspios_armhf/images/raspios_armhf-2022-04-07/2022-04-04-raspios-bullseye-armhf.img.xz.
Then follow the user guide to use the camera Raspberry Pi Documentation - Camera
Feel free to let me know if you need more help.

Hello,

thanks for your help. We downloaded the image you recommended and set up a RPI Zero 2 with it. We changed the config file /boot/config.txt by adding

dtoverlay=ov7251,media-controller=0

under the line [all]

However, the camera does not work. For example, when executing
libcamera-jpeg -o test.jpg
we get

[0:01:21.117955806] [1290] INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3424-e68e0f1e
[0:01:21.147143198] [1291] WARN CameraSensorProperties camera_sensor_properties.cpp:141 No static properties available for ‘ov7251’
[0:01:21.147239084] [1291] WARN CameraSensorProperties camera_sensor_properties.cpp:143 Please consider updating the camera sensor properties database
[0:01:21.147311375] [1291] ERROR CameraSensor camera_sensor.cpp:551 ‘ov7251 10-0060’: Camera sensor does not support test pattern modes.
[0:01:21.166697849] [1291] ERROR IPAProxy ipa_proxy.cpp:149 Configuration file ‘ov7251.json’ not found for IPA module ‘raspberrypi’
[0:01:21.166821703] [1291] ERROR IPARPI raspberrypi.cpp:190 Could not create camera helper for ov7251
[0:01:21.166885349] [1291] ERROR RPI raspberrypi.cpp:1197 Failed to load a suitable IPA library
[0:01:21.167198681] [1291] ERROR RPI raspberrypi.cpp:1129 Failed to register camera ov7251 10-0060: -22
ERROR: *** no cameras available ***

Any ideas?

Thanks,
Bruno