Implement Qt OpenCV image processing app
Some checks failed
Build Windows Release / Build Windows x64 Release on Linux (MinGW + Qt + OpenCV) (push) Failing after 2m15s

This commit is contained in:
luochen570
2026-05-30 23:09:27 +08:00
parent 03b873d4dd
commit 573c9d746c
6 changed files with 456 additions and 383 deletions

View File

@@ -7,6 +7,7 @@
#include <QPixmap>
#include <QScrollArea>
#include <QString>
#include <functional>
class QAction;
class QMenu;
@@ -48,6 +49,8 @@ private Q_SLOTS:
void flipVertical();
void grayscale();
void invertColors();
void extractObjects();
void classifyImage();
void updateZoomFromSlider(int value);
private:
@@ -57,16 +60,21 @@ private:
void createCentralWidget();
void setImage(const QImage &image, const QString &path = QString());
void updateImageView();
void updateSingleView(ImageLabel *label, const QImage &image);
void setZoomFactor(double factor);
void applyTransformedImage(const QImage &image);
void applyTransformedImage(const QImage &image, const QString &message = QString());
void processImageInThread(const QString &actionName, const QString &doneMessage, const std::function<QImage(QImage)> &processor);
void updateActions();
bool ensureImageLoaded(const QString &actionName) const;
bool writeImageToPath(const QString &path);
ImageLabel *imageLabel_ = nullptr;
QScrollArea *scrollArea_ = nullptr;
ImageLabel *originalLabel_ = nullptr;
ImageLabel *processedLabel_ = nullptr;
QScrollArea *originalScrollArea_ = nullptr;
QScrollArea *processedScrollArea_ = nullptr;
QSlider *zoomSlider_ = nullptr;
QImage originalImage_;
QImage currentImage_;
QString currentPath_;
double zoomFactor_ = 1.0;
@@ -85,6 +93,8 @@ private:
QAction *flipVerticalAction_ = nullptr;
QAction *grayscaleAction_ = nullptr;
QAction *invertAction_ = nullptr;
QAction *extractAction_ = nullptr;
QAction *classifyAction_ = nullptr;
};
#endif // MAINWINDOW_H