1、线性变换
线性变化是最好理解的,假设原图为srcimg , 变换后的图像为dstimg,则:
dstimg = a * srcimg +b
a为变换系数,如果a>1 ,则输出图像的对比度增大,当0<a<1则对比度有所减小,b值影响图像的亮度,当b>0时,图像亮度增加,b<0图像亮度减小;

void MainWindow::on_pushButton_clicked()
{
Mat srcImg = imread("D:\\1.jpg");
if(srcImg.empty())
{
QMessageBox::information(this,"警告","图片读取失败,请检查图片路径!");
return;
}
Mat imgShow ;
cvtColor(srcImg, imgShow, COLOR_BGR2RGB); // 图像格式转换
QImage qImg = QImage((unsigned char*)(imgShow.data), imgShow.cols,
imgShow.rows, imgShow.cols*imgShow.channels(), QImage::Format_RGB888);
ui->label->resize(qImg.width()/2 , qImg.height()/2);
ui->label->setPixmap(QPixmap::fromImage(qImg.scaled(ui->label->size(), Qt::KeepAspectRatio)));
}
void MainWindow::on_pushButton_3_clicked()
{
Mat srcImg = imread("D:\\1.jpg");
if(srcImg.empty())
{
QMessageBox::information(this,"警告","图片读取失败,请检查图片路径!");
return;
}
srcImg =0.8 *srcImg -10;
Mat imgShow ;
cvtColor(srcImg, imgShow, COLOR_BGR2RGB); // 图像格式转换
QImage qImg = QImage((unsigned char*)(imgShow.data), imgShow.cols,
imgShow.rows, imgShow.cols*imgShow.channels(), QImage::Format_RGB888);
ui->label_2->resize(qImg.width()/2

最低0.47元/天 解锁文章
4000

被折叠的 条评论
为什么被折叠?



