zhongfuqiang上传最新代码20250325
This commit is contained in:
@@ -242,7 +242,7 @@ void SerialDataHandler::showPic(QSize labelSize, int lens_n,
|
||||
}
|
||||
|
||||
QTransform transform;
|
||||
transform.rotate(90); // 可以调整旋转角度
|
||||
transform.rotate(270); // 可以调整旋转角度
|
||||
QImage rotatedImage = image.transformed(transform);
|
||||
QImage scaledImage = rotatedImage.scaled(labelSize, Qt::KeepAspectRatio);
|
||||
QPixmap pixmap = QPixmap::fromImage(scaledImage);
|
||||
@@ -272,7 +272,13 @@ void SerialDataHandler::showPic(QSize labelSize, int lens_n,
|
||||
else if (format == YUV420) {
|
||||
rotatedYuvData = convertQImageToYUV420(rotatedImage);
|
||||
}
|
||||
QString yuvFileName = saveDirPath + "/" + currentTime + ".yuv";
|
||||
|
||||
QString len_num = "";
|
||||
if (lens_n == 0)
|
||||
len_num = "left";
|
||||
else
|
||||
len_num = "right";
|
||||
QString yuvFileName = saveDirPath + "/" + len_num + "_" + currentTime + ".yuv";
|
||||
QFile yuvFile(yuvFileName);
|
||||
if (yuvFile.open(QIODevice::WriteOnly)) {
|
||||
yuvFile.write(rotatedYuvData);
|
||||
@@ -282,9 +288,10 @@ void SerialDataHandler::showPic(QSize labelSize, int lens_n,
|
||||
else {
|
||||
qWarning() << "Failed to save rotated YUV image to" << yuvFileName;
|
||||
}
|
||||
|
||||
|
||||
// 额外:可以保存旋转后的图像为JPG或PNG格式
|
||||
QString rotatedImageFileName = saveDirPath + "/" + currentTime + ".jpg";
|
||||
QString rotatedImageFileName = saveDirPath + "/" + len_num + "_" + currentTime + ".jpg";
|
||||
rotatedImage.save(rotatedImageFileName, "JPG");
|
||||
qDebug() << "JPG image saved to" << rotatedImageFileName;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user