Initial Linux Qt OpenCV project

This commit is contained in:
luochen570
2026-05-29 22:29:30 +08:00
commit 81d586c032
22 changed files with 1748 additions and 0 deletions

35
app/src/ImageWorker.cpp Normal file
View File

@@ -0,0 +1,35 @@
#include "ImageWorker.h"
void ImageWorker::process(cv::Mat image, ImageWorker::Operation operation, double value, int dx, int dy)
{
if (image.empty()) {
Q_EMIT failed(QStringLiteral("没有可处理的图片"));
return;
}
ProcessResult result;
switch (operation) {
case Operation::Rotate:
result = ImageProcessor::rotate(image, value);
break;
case Operation::Scale:
result = ImageProcessor::scale(image, value);
break;
case Operation::Translate:
result = ImageProcessor::translate(image, dx, dy);
break;
case Operation::ExtractTargets:
result = ImageProcessor::extractTargets(image);
break;
case Operation::ClassifySimple:
result = ImageProcessor::classifySimple(image);
break;
}
if (result.image.empty()) {
Q_EMIT failed(QStringLiteral("图像处理失败"));
return;
}
Q_EMIT finished(result);
}