当前位置:网站首页>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.
边栏推荐
- [reading papers] comparison of deeplobv1-v3 series, brief review
- JS get element
- Huawei equipment is configured with CE dual attribution
- Chapter7-11_ Deep Learning for Question Answering (2/2)
- Chapter7-10_ Deep Learning for Question Answering (1/2)
- The fastest empty string comparison method C code
- About the fact that I gave up the course of "Guyue private room course ROS manipulator development from introduction to actual combat" halfway
- Restrict cell input type and display format in CXGRID control
- Leetcode 473. Match to square [violence + pruning]
- 01 initial knowledge of wechat applet
猜你喜欢

Impossible d'afficher le contenu de la base de données après que l'idée a utilisé le pool de connexion c3p0 pour se connecter à la base de données SQL

What are the differences in cache/tlb?

Gadgets: color based video and image cutting

Automatic differential reference
![[51nod.3210] binary Statistics (bit operation)](/img/37/aa4a549deebf994b0049d41d49ff12.jpg)
[51nod.3210] binary Statistics (bit operation)

Classification and summary of system registers in aarch64 architecture of armv8/arnv9

Understand HMM

C language compressed string is saved to binary file, and the compressed string is read from binary file and decompressed.
![[reading some papers] introducing deep learning into the public horizon alexnet](/img/4b/6d9bafe48094ff6451efb211d83371.jpg)
[reading some papers] introducing deep learning into the public horizon alexnet

Paper reading - group normalization
随机推荐
【LeetCode-SQL】1532. Last three orders
After idea uses c3p0 connection pool to connect to SQL database, database content cannot be displayed
redis
regular expression
[reading some papers] introducing deep learning into the public horizon alexnet
[learning notes] xr872 GUI littlevgl 8.0 migration (file system)
0- blog notes guide directory (all)
Think: when do I need to disable mmu/i-cache/d-cache?
1000粉丝啦~
Huawei equipment configures private IP routing FRR
Paper reading - joint beat and downbeat tracking with recurrent neural networks
Easydl related documents and codes
Huawei equipment is configured with CE dual attribution
Laptop touch pad operation
Basic principle of bilateral filtering
拍拍贷母公司信也季报图解:营收24亿 净利5.3亿同比降10%
Sans certificate generation
Configuring virtual private network FRR for Huawei equipment
Mbedtls migration experience
智能安全配电装置如何减少电气火灾事故的发生?