Rename CLAHE to ApplyCLAHE
This commit is contained in:
+10
-10
@@ -1,12 +1,12 @@
|
|||||||
#include "clahe.h"
|
#include "applyclahe.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <opencv2/highgui.hpp>
|
#include <opencv2/highgui.hpp>
|
||||||
|
|
||||||
CLAHE::CLAHE()
|
ApplyCLAHE::ApplyCLAHE()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLAHE::loadFile(const QString &path)
|
void ApplyCLAHE::loadFile(const QString &path)
|
||||||
{
|
{
|
||||||
cv::Mat tmp;
|
cv::Mat tmp;
|
||||||
tmp = cv::imread(path.toLocal8Bit().data(), cv::IMREAD_COLOR | cv::IMREAD_ANYDEPTH);
|
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);
|
_image[0].convertTo(_lumImage, type, 1/_scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLAHE::saveFile(const QString &path)
|
void ApplyCLAHE::saveFile(const QString &path)
|
||||||
{
|
{
|
||||||
cv::Mat tmp;
|
cv::Mat tmp;
|
||||||
cv::merge(_image, 3, tmp);
|
cv::merge(_image, 3, tmp);
|
||||||
@@ -27,18 +27,18 @@ void CLAHE::saveFile(const QString &path)
|
|||||||
cv::imwrite(path.toLocal8Bit().data(), tmp);
|
cv::imwrite(path.toLocal8Bit().data(), tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLAHE::apply(float clipLimit, int kernelSize)
|
void ApplyCLAHE::apply(float clipLimit, int kernelSize)
|
||||||
{
|
{
|
||||||
cv::Mat lum;
|
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);
|
clahe->apply(_lumImage, lum);
|
||||||
lum.convertTo(_image[0], CV_32F, _scale);
|
lum.convertTo(_image[0], CV_32F, _scale);
|
||||||
double min, max;
|
double min, max;
|
||||||
cv::minMaxLoc(_image[0], &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::Mat tmp;
|
||||||
cv::merge(_image, 3, tmp);
|
cv::merge(_image, 3, tmp);
|
||||||
@@ -49,7 +49,7 @@ QPixmap CLAHE::getImage() const
|
|||||||
return QPixmap::fromImage(ret);
|
return QPixmap::fromImage(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
QPixmap CLAHE::getLumImage() const
|
QPixmap ApplyCLAHE::getLumImage() const
|
||||||
{
|
{
|
||||||
cv::Mat tmp;
|
cv::Mat tmp;
|
||||||
_image[0].convertTo(tmp, CV_8U, 2.55);
|
_image[0].convertTo(tmp, CV_8U, 2.55);
|
||||||
@@ -57,7 +57,7 @@ QPixmap CLAHE::getLumImage() const
|
|||||||
return QPixmap::fromImage(ret);
|
return QPixmap::fromImage(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CLAHE::imageLoaded() const
|
bool ApplyCLAHE::imageLoaded() const
|
||||||
{
|
{
|
||||||
return _lumImage.ptr();
|
return _lumImage.ptr();
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef CLAHE_H
|
#ifndef APPLYCLAHE_H
|
||||||
#define CLAHE_H
|
#define APPLYCLAHE_H
|
||||||
|
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
@@ -7,13 +7,13 @@
|
|||||||
#include <opencv2/imgproc.hpp>
|
#include <opencv2/imgproc.hpp>
|
||||||
#include <opencv2/imgcodecs.hpp>
|
#include <opencv2/imgcodecs.hpp>
|
||||||
|
|
||||||
class CLAHE
|
class ApplyCLAHE
|
||||||
{
|
{
|
||||||
cv::Mat _lumImage;
|
cv::Mat _lumImage;
|
||||||
cv::Mat _image[3];
|
cv::Mat _image[3];
|
||||||
double _scale;
|
double _scale;
|
||||||
public:
|
public:
|
||||||
CLAHE();
|
ApplyCLAHE();
|
||||||
void loadFile(const QString &path);
|
void loadFile(const QString &path);
|
||||||
void saveFile(const QString &path);
|
void saveFile(const QString &path);
|
||||||
void apply(float clipLimit, int kernelSize);
|
void apply(float clipLimit, int kernelSize);
|
||||||
@@ -22,4 +22,4 @@ public:
|
|||||||
bool imageLoaded() const;
|
bool imageLoaded() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CLAHE_H
|
#endif // APPLYCLAHE_H
|
||||||
@@ -33,13 +33,13 @@ unix:PKGCONFIG += opencv
|
|||||||
SOURCES += \
|
SOURCES += \
|
||||||
main.cpp \
|
main.cpp \
|
||||||
mainwindow.cpp \
|
mainwindow.cpp \
|
||||||
clahe.cpp \
|
imagescrollarea.cpp \
|
||||||
imagescrollarea.cpp
|
applyclahe.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
mainwindow.h \
|
mainwindow.h \
|
||||||
clahe.h \
|
imagescrollarea.h \
|
||||||
imagescrollarea.h
|
applyclahe.h
|
||||||
|
|
||||||
# Default rules for deployment.
|
# Default rules for deployment.
|
||||||
qnx: target.path = /tmp/$${TARGET}/bin
|
qnx: target.path = /tmp/$${TARGET}/bin
|
||||||
|
|||||||
+3
-3
@@ -6,14 +6,14 @@
|
|||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QDockWidget>
|
#include <QDockWidget>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include "clahe.h"
|
#include "applyclahe.h"
|
||||||
|
|
||||||
const QString imageFilter = "Images (*.png *.jpg *.jpeg);;All files (*)";
|
const QString imageFilter = "Images (*.png *.jpg *.jpeg);;All files (*)";
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
|
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
|
||||||
{
|
{
|
||||||
setupUI();
|
setupUI();
|
||||||
_clahe = new CLAHE;
|
_clahe = new ApplyCLAHE;
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
@@ -86,7 +86,7 @@ void MainWindow::setupUI()
|
|||||||
connect(applyButton, SIGNAL(clicked()), this, SLOT(applyClahe()));
|
connect(applyButton, SIGNAL(clicked()), this, SLOT(applyClahe()));
|
||||||
|
|
||||||
_kernelSizeSelect = new QComboBox;
|
_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()));
|
connect(_kernelSizeSelect, SIGNAL(currentIndexChanged(int)), this, SLOT(applyLive()));
|
||||||
|
|
||||||
QHBoxLayout *claheLayout = new QHBoxLayout;
|
QHBoxLayout *claheLayout = new QHBoxLayout;
|
||||||
|
|||||||
+2
-2
@@ -4,7 +4,7 @@
|
|||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include "clahe.h"
|
#include "applyclahe.h"
|
||||||
#include "imagescrollarea.h"
|
#include "imagescrollarea.h"
|
||||||
|
|
||||||
class MainWindow : public QMainWindow
|
class MainWindow : public QMainWindow
|
||||||
@@ -13,7 +13,7 @@ class MainWindow : public QMainWindow
|
|||||||
QComboBox *_kernelSizeSelect;
|
QComboBox *_kernelSizeSelect;
|
||||||
QSlider *_clipLimitSlider;
|
QSlider *_clipLimitSlider;
|
||||||
QLineEdit *_clipLimitEdit;
|
QLineEdit *_clipLimitEdit;
|
||||||
CLAHE *_clahe;
|
ApplyCLAHE *_clahe;
|
||||||
ImageScrollArea *_imageScrollArea;
|
ImageScrollArea *_imageScrollArea;
|
||||||
QAction *_liveApply;
|
QAction *_liveApply;
|
||||||
public:
|
public:
|
||||||
|
|||||||
Reference in New Issue
Block a user