OpenCV曝光参数和快门时间的对应关系
opencv -Camera曝光设置
1、曝光设置
cv_cap.set(cv::CAP_PROP_AUTO_EXPOSURE, 0.25); // where 0.25 means "manual exposure, manual iris"cv_cap.set(CV_CAP_PROP_EXPOSURE, -13);
2、设置自动曝光为手动曝光
cv_cap.set(cv::CAP_PROP_AUTO_EXPOSURE, 0.25); // where 0.25 means "manual exposure, manual iris"
3、曝光参数具体对应于曝光时间
OpenCV_exposure |
快门时间ms |
-1 |
640 |
-2 |
320 |
-3 |
160 |
-4 |
80 |
-5 |
40 |
-6 |
20 |
-7 |
10 |
-8 |
5 |
-9 |
2.5 |
-10 |
1.25 |
-11 |
0.625 |
-12 |
0.3125 |
-13 |
0.15625 |
-14 |
0.078125 |
说明:x为opencv中设置的曝光值OpenCV_exposure
y为快门时间
4、代码实现:
void cameExposureTestAndExposureFusionTest(VideoCapture cap)
{int ix = 0;int numImages = 4;Mat frame;vector<Mat> images;//是否图像映射bool needsAlignment = true;//cap.set()auto i = cap.get(CAP_PROP_EXPOSURE);cout << "设置之前曝光为:" << i << endl;cap.set(CAP_PROP_AUTO_EXPOSURE, 0.25);while (waitKey(30) != 27){
/*int 循环调节 = -13;while (1){if (循环调节 == 0){循环调节 = -13;break;}//cout << "设置之后曝光为:" << cap.get(CAP_PROP_EXPOSURE);cap.set(CAP_PROP_EXPOSURE, 循环调节);//cout << "设置之后曝光为:" << cap.get(CAP_PROP_EXPOSURE)<<endl;cap >> frame;putText(frame, "Exposure:" + to_string(循环调节), Point(20, 30), 3, 1.0, Scalar(255, 0, 0));imshow("调用摄像头", frame);imwrite("E:\\Project_OpenCV_C++\\openCV_Test1\\openCV_Test3\\cameExposureTest\\" + to_string(循环调节) + ".jpg", frame);waitKey(30);images.push_back(frame);循环调节= 循环调节+1;}
*/vector<float> times;// 曝光时间列表const float timesArray[] = { 1 / 30.0f,0.25,2.5,15.0 };times.assign(timesArray, timesArray + numImages);// 曝光值列表float OpenCV_exposure[] = {NULL };//这里将快门时间转换成OpenCV的曝光参数for (ix = 0; ix < 4; ix++){OpenCV_exposure[ix] = -(log(640 / (timesArray[ix]*1000) ) + 1);}for (ix=0; ix<4; ix++){cap.set(CAP_PROP_EXPOSURE, OpenCV_exposure[ix]);cap >> frame;imshow("调用摄像头", frame);imwrite("E:\\Project_OpenCV_C++\\openCV_Test1\\openCV_Test3\\cameExposureTest\\" + to_string(ix) + ".jpg", frame);waitKey(30);images.push_back(frame);}// Align input imagesif (needsAlignment){cout << "Aligning images ... " << endl;Ptr<AlignMTB> alignMTB = createAlignMTB();alignMTB->process(images, images);}else{cout << "Skipping alignment ... " << endl;}// 获取图像响应函数 (CRF)Mat responseDebevec;Ptr<CalibrateDebevec> calibrateDebevec = createCalibrateDebevec();calibrateDebevec->process(images, responseDebevec, times);// Merge using Exposure Fusion 图像融合cout << "Merging using Exposure Fusion ... " << endl;Mat exposureFusion;Ptr<MergeMertens> mergeMertens = createMergeMertens();mergeMertens->process(images, exposureFusion);imwrite("E:\\Project_OpenCV_C++\\openCV_Test1\\openCV_Test3\\cameExposureTestAndExposureFusionTest\\exposure-fusion.jpg", exposureFusion*255);// 将图像合并为HDR线性图像Mat hdrDebevec;Ptr<MergeDebevec> mergeDebevec = createMergeDebevec();mergeDebevec->process(images, hdrDebevec, times, responseDebevec);// 保存图像imwrite("E:\\Project_OpenCV_C++\\openCV_Test1\\openCV_Test3\\cameExposureTestAndExposureFusionTest\\hdrDebevec.hdr", hdrDebevec);// 使用Drago色调映射算法获得24位彩色图像Mat ldrDrago;Ptr<TonemapDrago> tonemapDrago = createTonemapDrago(1.0, 0.7);tonemapDrago->process(hdrDebevec, ldrDrago);ldrDrago = 3 * ldrDrago;imwrite("E:\\Project_OpenCV_C++\\openCV_Test1\\openCV_Test3\\cameExposureTestAndExposureFusionTest\\ldr-Drago.jpg", ldrDrago * 255);// 使用Durand色调映射算法获得24位彩色图像
/*Mat ldrDurand;Ptr<TonemapDurand> tonemapDurand = createTonemapDurand(1.5, 4, 1.0, 1, 1);tonemapDurand->process(hdrDebevec, ldrDurand);ldrDurand = 3 * ldrDurand;imwrite("E:\\Project_OpenCV_C++\\openCV_Test1\\openCV_Test3\\cameExposureTestAndExposureFusionTest\\ldr-Durand.jpg", ldrDurand * 255);
*/// 使用Reinhard色调映射算法获得24位彩色图像Mat ldrReinhard;Ptr<TonemapReinhard> tonemapReinhard = createTonemapReinhard(1.5, 0, 0, 0);tonemapReinhard->process(hdrDebevec, ldrReinhard);imwrite("E:\\Project_OpenCV_C++\\openCV_Test1\\openCV_Test3\\cameExposureTestAndExposureFusionTest\\ldr-Reinhard.jpg", ldrReinhard * 255);// 使用Mantiuk色调映射算法获得24位彩色图像Mat ldrMantiuk;Ptr<TonemapMantiuk> tonemapMantiuk = createTonemapMantiuk(2.2, 0.85, 1.2);tonemapMantiuk->process(hdrDebevec, ldrMantiuk);ldrMantiuk = 3 * ldrMantiuk;imwrite("ldr-Mantiuk.jpg", ldrMantiuk * 255);imwrite("E:\\Project_OpenCV_C++\\openCV_Test1\\openCV_Test3\\cameExposureTestAndExposureFusionTest\\ldr-Mantiuk.jpg", ldrMantiuk * 255);images.clear();}return;
}
OpenCV曝光参数和快门时间的对应关系相关推荐
- opencv 读取一帧时间及imshow耗时
一.前言 由于想知道自己电脑i7 使用opencv读取一帧速度,测试视频大小为480*640,发现当使用VideoCapture::read()读取一帧,并用imshow显示图像,总共需耗时16ms左 ...
- 使用opencv按图片修改时间进行图片读取
直接上代码,注释很详细 #include <sys/stat.h> #include <string> #include <algorithm> #include ...
- python当前时间命名图片,python+opencv保存图片以系统时间命名怎么敲?
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 mport numpy as np import cv2 import time cap = cv2.VideoCapture(0) time = tim ...
- 相机拍摄时最重要的三个参数——光圈、快门、ISO
如果你对相机只有很少了解,那么看这篇文章再好不过啦,我结合很多资料,力图用最通俗易懂的方式进行讲解. 相机拍摄时最重要的3个参数就是--光圈.快门.ISO 次重要的参数有--焦距.景深.曝光 在介绍光 ...
- matlab 工业相机 曝光时间_工业相机的曝光、曝光时间、快门、增益
这几个概念在网上资料比较少,讲得都比较模糊. 勇哥先上一张图,后面再介绍具体的概念. 什么是曝光? 尽管摄影自诞生以来,无数人都在探索相机这个工具究竟能发挥那些作用.但一个最基本的作用,就是把我们眼睛 ...
- 如何正确曝光。关键:快门、光圈、ISO - [摄影基础]
版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明 http://ivanwu.blogbus.com/logs/7481314.html 对曝光的控制是整个摄影过程中最基础也是最重要的 ...
- 让模糊图片变视频,找回丢失的时间维度,MIT这项新研究简直像魔术
晓查 发自 凹非寺 量子位 报道 | 公众号 QbitAI 在拍照时我们常常会遇到这样的苦恼:由于设置的快门时间太长,快速运动的物体会在身后产生严重的拖影. 除非是为了特殊的艺术效果,一般来说这张照片 ...
- OpenCV2学习笔记(十四):基于OpenCV卡通图片处理
得知OpenCV有一段时间.除了研究的各种算法的内容.除了从备用,据导游书籍和资料,尝试结合链接的图像处理算法和日常生活,第一桌面上(随着摄像头)完成了一系列的视频流处理功能.开发平台Qt5.3.2+ ...
- opencv python3树莓派_树莓派4B日志七:Python3上的OpenCV安装
1.准备工作 硬件:装好系统的树莓派. 软件:Putty,VNC Viewer.(也可以直接在屏幕上操作) 2.前言 前面几期介绍了树莓派的一些基本配置,今天让我们来打开新世界的大门.安装OpenCV ...
- 单反光圈、快门和感光度的关系
在摄影中,光圈.快门和感光度,他们都有自己的一技之长,而且共同掌握着控制照片亮度的秘密.那到底有啥秘密呢?今天蚂蚁就为大家解开这个秘密. 光圈.快门和感光度的简介 光圈:擅长虚化,并通过控制光圈的大小 ...
最新文章
- Ubuntu触摸板使用
- python读取目录_Python读取一个目录下所有目录和文件
- 【git学习三】git基础之git管理远程仓库
- python(matplotlib3)——ticks(坐标刻度)能见度
- c语言如何用fscanf将字符串读取,在c语言中如何将文本内容 赋给一个 字符串
- MyBatis 实际使用案例-typeAliases
- 短信发送:webservice调用第三方接口发送短信
- [2021-09-11 CQBZ/HSZX多校联考 T1] 茅山道术 (后缀和优化dp)
- JDK8新特性之Lambda表达式
- 防止Linux库so中的接口冲突
- SpringBoot2 整合 AXIS2 服务端和客户端
- 崩溃!新浪程序员加班错失 77 万年会大奖
- Yum (yellow dog update manager)
- 苹果官宣!iOS 16正式定档了 刘海屏MacBook Air或亮相
- 动态模型之增压暂停【FunTester测试框架】
- JS操作JSON数据交换
- 拿到一份陌生数据我们应该怎么办
- Socket.IO文档(1)
- android rfid 数据解析_基于RFID技术的标签数据完整性与安全性解析
- Kafka学习之(四)PHP操作Kafka