You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I follows your guide and enable raspberrypi camera_v2 as a USB Camera for Windows PC.
The bmControls changed as follows:
cat /sys/kernel/config/usb_gadget/pi4/functions/uvc.usb0/control/processing/default/bmControls
255
47
Now the brightness/saturation/sharpness/contrast can runtime change and take effect, but the auto exposure mode is always 0 and change the exposure time don't take effect.
I also change the /usr/bin/v4l2-ctl -c auto_exposure=1, then the auto exposure mode is fixed to manual mode, the exposure time can runtime change and take effect, but the auto exposure mode can't change to auto mode any more.
It looks like the auto exposure mode is fixed by below codes and can be changed. If delete the line /usr/bin/v4l2-ctl -c auto_exposure=0, the result is the auto exposure mode is fixed to auto mode.
The test application as follows, the Auto Exposure Mode is always 0 even if I call cap.set(CV_CAP_PROP_AUTO_EXPOSURE, 1) to change to manual AE mode. The application can work well is use Windows PC default front camera.
#include "opencv2/opencv.hpp"
#include
using namespace cv;
using namespace std;
int main()
{
VideoCapture cap(1);
Mat frame;
auto exp_time = cap.get(CV_CAP_PROP_EXPOSURE);
cout << "Init Exposure Time: " << exp_time << endl;
auto gain = cap.get(CV_CAP_PROP_GAIN);
cout << "Init Gain: " << gain << endl;
auto ae_mode = cap.get(CV_CAP_PROP_AUTO_EXPOSURE);
cout << "Init Auto Exposure Mode: " << ae_mode << endl << endl;
cap.set(CV_CAP_PROP_AUTO_EXPOSURE, 1);
exp_time = cap.get(CV_CAP_PROP_EXPOSURE);
cout << "Exposure Time: " << exp_time << endl;
gain = cap.get(CV_CAP_PROP_GAIN);
cout << "Gain: " << gain << endl;
ae_mode = cap.get(CV_CAP_PROP_AUTO_EXPOSURE);
cout << "Auto Exposure Mode: " << ae_mode << endl << endl;
cap >> frame;
int i = 0;
while (waitKey(30) != 27)
{
i++;
i %= 100;
cap.set(CV_CAP_PROP_EXPOSURE, (i / 10) - 10);
exp_time = cap.get(CV_CAP_PROP_EXPOSURE);
cout << "Exposure Time:" << exp_time << endl;
gain = cap.get(CV_CAP_PROP_GAIN);
cout << "Gain: " << gain << endl;
ae_mode = cap.get(CV_CAP_PROP_AUTO_EXPOSURE);
cout << "Auto Exposure Mode: " << ae_mode << endl << endl;
cap >> frame;
putText(frame, "Exposure:" + to_string(i / 10 - 10), Point(20, 30), 3, 1.0, Scalar(255, 0, 0));
imshow("Piwebcam", frame);
}
return 0;
}
The text was updated successfully, but these errors were encountered:
I follows your guide and enable raspberrypi camera_v2 as a USB Camera for Windows PC.
The bmControls changed as follows:
cat /sys/kernel/config/usb_gadget/pi4/functions/uvc.usb0/control/processing/default/bmControls
255
47
cat /sys/kernel/config/usb_gadget/pi4/functions/uvc.usb0/control/terminal/camera/default/bmControls
14
0
0
Now the brightness/saturation/sharpness/contrast can runtime change and take effect, but the auto exposure mode is always 0 and change the exposure time don't take effect.
I also change the /usr/bin/v4l2-ctl -c auto_exposure=1, then the auto exposure mode is fixed to manual mode, the exposure time can runtime change and take effect, but the auto exposure mode can't change to auto mode any more.
It looks like the auto exposure mode is fixed by below codes and can be changed. If delete the line /usr/bin/v4l2-ctl -c auto_exposure=0, the result is the auto exposure mode is fixed to auto mode.
#!/bin/bash
sudo /home/pi/uvc-gadget/multi-gadget.sh
/usr/bin/v4l2-ctl -c auto_exposure=0 // change to 1 manual mode
/usr/bin/v4l2-ctl -c auto_exposure_bias=8
/usr/bin/v4l2-ctl -c contrast=20
/usr/bin/v4l2-ctl -c video_bitrate=25000000
sudo /home/pi/uvc-gadget/uvc-gadget -u /dev/video1 -v /dev/video0
The test application as follows, the Auto Exposure Mode is always 0 even if I call cap.set(CV_CAP_PROP_AUTO_EXPOSURE, 1) to change to manual AE mode. The application can work well is use Windows PC default front camera.
#include "opencv2/opencv.hpp"
#include
using namespace cv;
using namespace std;
int main()
{
VideoCapture cap(1);
Mat frame;
}
The text was updated successfully, but these errors were encountered: