当前位置:网站首页>Opencv 10 brightness contrast adjustment
Opencv 10 brightness contrast adjustment
2022-06-13 02:29:00 【An unforgettable squirrel】
The built-in program to adjust the progress bar will produce a negative width or height , Change the code to rect It can run normally , Examples are as follows :
rect.Top = histogramImage.Rows;
rect.Left = j * binW;
rect.Width = binW;
rect.Height = (int)(scaledHistogram.Get<float>(j));
histogramImage.Rectangle(
rect,
color,
-1);Program main function and running logic analysis
The values of brightness and contrast are 0-200 Before ,
After adjustment 100 by 0 Point set positive and negative , Calculate the parameters according to the positive and negative conditions , The code is as follows :
if (contrast > 0)
{
double delta = 127f * contrast / 100f;
alpha = 255f / (255f - delta * 2);
beta = alpha * (brightness - delta);
}
else
{
double delta = -128f * contrast / 100;
alpha = (256f - delta * 2) / 255f;
beta = alpha * brightness + delta;
}And then call ConvertTo Function to achieve transformation and display work .
src.ConvertTo(modifiedSrc, MatType.CV_8UC3, alpha, beta);
It should be noted that , The program should be able to output histogram related parameters , After running, there is indeed a histogram window , But the window content is empty , Because there is no relative how to apply , Don't fix this bug.
边栏推荐
- Stm32f4 DMA Da sine wave generator keil5 Hal library cubemx
- speech production model
- Thesis reading - autovc: zero shot voice style transfer with only autoencoder loss
- json,xml,txt
- 01 初识微信小程序
- Share three stories about CMDB
- Understand speech denoising
- A real-time target detection model Yolo
- Several articles on norms
- How can intelligent safe power distribution devices reduce the occurrence of electrical fire accidents?
猜你喜欢

Laravel permission export
![[reading papers] transformer miscellaneous notes, especially miscellaneous](/img/c3/7788b1bcd71b90c18cf66bb915db32.jpg)
[reading papers] transformer miscellaneous notes, especially miscellaneous

Paipai loan parent company Xinye quarterly report diagram: revenue of RMB 2.4 billion, net profit of RMB 530million, a year-on-year decrease of 10%

speech production model

Chapter7-12_ Controllable Chatbot

Laravel 权限导出

拍拍贷母公司信也季报图解:营收24亿 净利5.3亿同比降10%
![[pytorch] kaggle large image dataset data analysis + visualization](/img/b0/7b8aff44d6bedd7ca2c705f13a8556.jpg)
[pytorch] kaggle large image dataset data analysis + visualization

Think about the possibility of attacking secure memory through mmu/tlb/cache
![How to solve the problem of obtaining the time through new date() and writing out the difference of 8 hours between the database and the current time [valid through personal test]](/img/c5/f17333cdb72a1ce09aa54e38dd0a8c.png)
How to solve the problem of obtaining the time through new date() and writing out the difference of 8 hours between the database and the current time [valid through personal test]
随机推荐
Redirection setting parameters -redirectattributes
Share three stories about CMDB
[keras] generator for 3D u-net source code analysis py
03 recognize the first view component
04路由跳转并携带参数
Introduction to easydl object detection port
01 initial knowledge of wechat applet
Huawei equipment is configured with dual reflectors to optimize the backbone layer of the virtual private network
Laravel permission export
SQL server deletes all tables and all stored procedures in the database
[keras learning]fit_ Generator analysis and complete examples
How to learn to understand Matplotlib instead of simple code reuse
About the fact that I gave up the course of "Guyue private room course ROS manipulator development from introduction to actual combat" halfway
Installing Oracle with docker for Mac
How to do Internet for small enterprises
Number of special palindromes in basic exercise of test questions
4.11 introduction to firmware image package
[dest0g3 520 orientation] dest0g3, which has been a long time since we got WP_ heap
Leetcode daily question - 890 Find and replace mode
[reading paper] generate confrontation network Gan