Qt QImage图片翻转(水平、垂直、顺时针、逆时针)

 1 水平翻转
 2 void ImageViewer::horFilp()
 3 {
 4     image = image.mirrored(true, false);
 5     imageLabel->setPixmap(QPixmap::fromImage(image));
 6 }
 7 垂直翻转
 8 void ImageViewer::verFilp()
 9 {
10     image = image.mirrored(false, true);
11     imageLabel->setPixmap(QPixmap::fromImage(image));
12 }
13 顺时针旋转
14 void ImageViewer::clockwise()
15 {
16     QMatrix matrix;
17     matrix.rotate(90.0);
18     image = image.transformed(matrix,Qt::FastTransformation);
19     imageLabel->setPixmap(QPixmap::fromImage(image));
20 }
21 逆时针旋转
22 void ImageViewer::anticlockwise()
23 {
24     QMatrix matrix;
25     matrix.rotate(-90.0);
26     image = image.transformed(matrix,Qt::FastTransformation);
27     imageLabel->setPixmap(QPixmap::fromImage(image));
28 }

 

上一篇:JS中style.display和style.visibility的区别


下一篇:Qt中使用QImage获取Opencv图像