1
0

Rename CLAHE to ApplyCLAHE

This commit is contained in:
2020-04-26 08:24:50 +02:00
parent dc2f0e3490
commit 508d8f44f0
5 changed files with 24 additions and 24 deletions
+10 -10
View File
@@ -1,12 +1,12 @@
#include "clahe.h"
#include "applyclahe.h"
#include <QDebug>
#include <opencv2/highgui.hpp>
CLAHE::CLAHE()
ApplyCLAHE::ApplyCLAHE()
{
}
void CLAHE::loadFile(const QString &path)
void ApplyCLAHE::loadFile(const QString &path)
{
cv::Mat tmp;
tmp = cv::imread(path.toLocal8Bit().data(), cv::IMREAD_COLOR | cv::IMREAD_ANYDEPTH);
@@ -18,7 +18,7 @@ void CLAHE::loadFile(const QString &path)
_image[0].convertTo(_lumImage, type, 1/_scale);
}
void CLAHE::saveFile(const QString &path)
void ApplyCLAHE::saveFile(const QString &path)
{
cv::Mat tmp;
cv::merge(_image, 3, tmp);
@@ -27,18 +27,18 @@ void CLAHE::saveFile(const QString &path)
cv::imwrite(path.toLocal8Bit().data(), tmp);
}
void CLAHE::apply(float clipLimit, int kernelSize)
void ApplyCLAHE::apply(float clipLimit, int kernelSize)
{
cv::Mat lum;
cv::Ptr<cv::CLAHE> clahe = cv::createCLAHE(clipLimit, cv::Size(kernelSize, kernelSize));
cv::Ptr<cv::CLAHE> clahe = cv::createCLAHE(clipLimit, cv::Size(_lumImage.cols/kernelSize, _lumImage.rows/kernelSize));
clahe->apply(_lumImage, lum);
lum.convertTo(_image[0], CV_32F, _scale);
double min, max;
cv::minMaxLoc(_image[0], &min, &max);
qDebug() << min << max;
qDebug() << min << max << clipLimit << kernelSize;
}
QPixmap CLAHE::getImage() const
QPixmap ApplyCLAHE::getImage() const
{
cv::Mat tmp;
cv::merge(_image, 3, tmp);
@@ -49,7 +49,7 @@ QPixmap CLAHE::getImage() const
return QPixmap::fromImage(ret);
}
QPixmap CLAHE::getLumImage() const
QPixmap ApplyCLAHE::getLumImage() const
{
cv::Mat tmp;
_image[0].convertTo(tmp, CV_8U, 2.55);
@@ -57,7 +57,7 @@ QPixmap CLAHE::getLumImage() const
return QPixmap::fromImage(ret);
}
bool CLAHE::imageLoaded() const
bool ApplyCLAHE::imageLoaded() const
{
return _lumImage.ptr();
}
+5 -5
View File
@@ -1,5 +1,5 @@
#ifndef CLAHE_H
#define CLAHE_H
#ifndef APPLYCLAHE_H
#define APPLYCLAHE_H
#include <QImage>
#include <QPixmap>
@@ -7,13 +7,13 @@
#include <opencv2/imgproc.hpp>
#include <opencv2/imgcodecs.hpp>
class CLAHE
class ApplyCLAHE
{
cv::Mat _lumImage;
cv::Mat _image[3];
double _scale;
public:
CLAHE();
ApplyCLAHE();
void loadFile(const QString &path);
void saveFile(const QString &path);
void apply(float clipLimit, int kernelSize);
@@ -22,4 +22,4 @@ public:
bool imageLoaded() const;
};
#endif // CLAHE_H
#endif // APPLYCLAHE_H
+4 -4
View File
@@ -33,13 +33,13 @@ unix:PKGCONFIG += opencv
SOURCES += \
main.cpp \
mainwindow.cpp \
clahe.cpp \
imagescrollarea.cpp
imagescrollarea.cpp \
applyclahe.cpp
HEADERS += \
mainwindow.h \
clahe.h \
imagescrollarea.h
imagescrollarea.h \
applyclahe.h
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
+3 -3
View File
@@ -6,14 +6,14 @@
#include <QLineEdit>
#include <QDockWidget>
#include <QHBoxLayout>
#include "clahe.h"
#include "applyclahe.h"
const QString imageFilter = "Images (*.png *.jpg *.jpeg);;All files (*)";
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{
setupUI();
_clahe = new CLAHE;
_clahe = new ApplyCLAHE;
}
MainWindow::~MainWindow()
@@ -86,7 +86,7 @@ void MainWindow::setupUI()
connect(applyButton, SIGNAL(clicked()), this, SLOT(applyClahe()));
_kernelSizeSelect = new QComboBox;
_kernelSizeSelect->addItems({"8", "16", "32", "64", "128", "256"});
_kernelSizeSelect->addItems({"8", "12", "16", "24", "32", "64", "128", "256"});
connect(_kernelSizeSelect, SIGNAL(currentIndexChanged(int)), this, SLOT(applyLive()));
QHBoxLayout *claheLayout = new QHBoxLayout;
+2 -2
View File
@@ -4,7 +4,7 @@
#include <QMainWindow>
#include <QLabel>
#include <QComboBox>
#include "clahe.h"
#include "applyclahe.h"
#include "imagescrollarea.h"
class MainWindow : public QMainWindow
@@ -13,7 +13,7 @@ class MainWindow : public QMainWindow
QComboBox *_kernelSizeSelect;
QSlider *_clipLimitSlider;
QLineEdit *_clipLimitEdit;
CLAHE *_clahe;
ApplyCLAHE *_clahe;
ImageScrollArea *_imageScrollArea;
QAction *_liveApply;
public: