当前位置:网站首页>Opencv learning log 29 -- gamma correction
Opencv learning log 29 -- gamma correction
2022-07-06 16:07:00 【@Spring sauce】
Preface
This article focuses on opencv Image processing gamma Application of correction .
One 、gamma correction
// The first question is gamma correction
#include <opencv2/opencv.hpp>
#include <iostream>
#include<cmath>
using namespace cv;
using namespace std;
int main()
{
cv::Mat dst;
cv::Mat dstbin;
cv::Mat dsttemp;
cv::Mat finalpicture;
cv::Mat src = imread("C://Users//john//Desktop//1.jpg");
cv::Mat srcgray = imread("C://Users//john//Desktop//1.jpg", 0);
int i, j;
//cout << sizeof(srcgray) << endl; 538 478
int row = srcgray.rows;
int col = srcgray.cols;
cout << row << endl;
cout << col << endl;
int size = row*col;
// double sum = 0;
// cout << 1 / 0.5 << endl;
float lut[256];// Definition table
float r =0.4;
for (i = 0; i <= 255; i++)
{
lut[i] =float( i )/float(255);
}
float secondlut[256];
for (i = 0; i <= 255; i++)
{
secondlut[i] = pow(lut[i], r);
}
for (int j = 0; j < row; j++) // Read total gray value
{
for (int i = 0; i < col; i++)
{
uchar average = srcgray.at<uchar>(j, i);
srcgray.at<uchar>(j, i) = secondlut[average]*255;
}
}
//(x/sum)~r*255
cout << sum << endl;
cv::imshow("srcgray", srcgray);
cv::imshow("final", src);
waitKey(0);
}
summary
1. The code can run directly , If you don't understand, you can leave a message .
2. Missing material pictures , Follow up, thank you .
边栏推荐
- 【练习-11】4 Values whose Sum is 0(和为0的4个值)
- 渗透测试 ( 5 ) --- 扫描之王 nmap、渗透测试工具实战技巧合集
- 用C语言写网页游戏
- 信息安全-威胁检测-flink广播流BroadcastState双流合并应用在过滤安全日志
- Hdu-6025-prime sequence (girls' competition)
- 【练习-7】(Uva 10976)Fractions Again?!(分数拆分)
- Opencv learning log 18 Canny operator
- 0-1 knapsack problem (I)
- 【练习-9】Zombie’s Treasure Chest
- CS zero foundation introductory learning record
猜你喜欢

Penetration test (2) -- penetration test system, target, GoogleHacking, Kali tool

Nodejs+vue网上鲜花店销售信息系统express+mysql
![[teacher Gao UML software modeling foundation] collection of exercises and answers for level 20 cloud class](/img/57/bc6eda91f7263acda38b9ee8732318.png)
[teacher Gao UML software modeling foundation] collection of exercises and answers for level 20 cloud class

信息安全-安全编排自动化与响应 (SOAR) 技术解析

入门C语言基础问答

Analysis of protobuf format of real-time barrage and historical barrage at station B

Write web games in C language

C语言数组的概念
![mysql导入数据库报错 [Err] 1273 – Unknown collation: ‘utf8mb4_0900_ai_ci’](/img/e6/f4a696179282fe1f4193410c5a493a.png)
mysql导入数据库报错 [Err] 1273 – Unknown collation: ‘utf8mb4_0900_ai_ci’

Information security - Epic vulnerability log4j vulnerability mechanism and preventive measures
随机推荐
差分(一维,二维,三维) 蓝桥杯三体攻击
D - Function(HDU - 6546)女生赛
Gartner: five suggestions on best practices for zero trust network access
【练习-11】4 Values whose Sum is 0(和为0的4个值)
Auto.js入门
区间和------离散化
7-1 understand everything (20 points)
Ball Dropping
Research Report of peripheral venous catheter (pivc) industry - market status analysis and development prospect prediction
滲透測試 ( 1 ) --- 必備 工具、導航
Opencv learning log 16 paperclip count
想应聘程序员,您的简历就该这样写【精华总结】
Penetration test (3) -- Metasploit framework (MSF)
F - Birthday Cake(山东省赛)
初入Redis
China exterior wall cladding (EWC) market trend report, technical dynamic innovation and market forecast
Borg maze (bfs+ minimum spanning tree) (problem solving report)
Borg Maze (BFS+最小生成树)(解题报告)
[exercise-3] (UVA 442) matrix chain multiplication
Nodejs+vue online fresh flower shop sales information system express+mysql