OPENCV adjusting exposure

Source: Internet
Author: User

Formula First effect:

The upper left corner represents the exposure parameters, general -10~-3 and then the big basic is too bright ...



The first thing to determine is whether the camera can adjust the exposure ... Not all cameras support the adjustment of exposure.


1. See if the camera can adjust the exposure.


Download Open AMCap, select a specific camera, Options--video device--properties--see if the camera control in the second column can adjust the exposure ...


If you can, then the basic can be OPENCV control to adjust the exposure


2. Configure the OpenCV adjustment

Configuration environment See: Address

The simple brute code is as follows:

#include <opencv2/opencv.hpp>
#include <iostream>
using namespace CV;
using namespace std;
int main ()
{
	videocapture cap (0);
	Mat frame;
	Cap.set ()
	Auto i = Cap.get (cv_cap_prop_exposure);
	cout << "Exposure before setting is:" << i << Endl;

	int loop adjustment = 0;
	while (Waitkey ()!=27)
	{
		cyclic adjustment + +;
		Cyclic regulation%=;
		cout << "After setting exposure as:" << cap.get (cap_prop_exposure);
		Cap.set (Cv_cap_prop_exposure, (cyclic adjustment/10) -10);
		cout << "After setting exposure as:" << cap.get (cap_prop_exposure) <<endl;
		Cap >> frame;
		Puttext (Frame, "Exposure:" + to_string (cyclic adjustment/10-10), point (3), 0, 1.0, Scalar (255, 0));
		Imshow ("Call camera", frame);
	return 0;
}


Accidentally need to adjust the camera parameters, so I wrote a blog ~ ~


OpenCV Use Pleasant ~



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.