-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Populated the repository with computer_vision project
Contains all plugins and main app until end of chapter 7
- Loading branch information
Showing
50 changed files
with
4,913 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#include "color_plugin.h" | ||
|
||
#include "ui_plugin.h" | ||
|
||
Color_Plugin::Color_Plugin() | ||
{ | ||
// Insert initialization codes here ... | ||
} | ||
|
||
Color_Plugin::~Color_Plugin() | ||
{ | ||
// Insert cleanup codes here ... | ||
} | ||
|
||
QString Color_Plugin::title() | ||
{ | ||
return this->metaObject()->className(); | ||
} | ||
|
||
QString Color_Plugin::version() | ||
{ | ||
return "1.0.0"; | ||
} | ||
|
||
QString Color_Plugin::description() | ||
{ | ||
return ""; | ||
} | ||
|
||
QString Color_Plugin::help() | ||
{ | ||
return ""; | ||
} | ||
|
||
void Color_Plugin::setupUi(QWidget *parent) | ||
{ | ||
ui = new Ui::PluginGui; | ||
ui->setupUi(parent); | ||
|
||
ui->colorMapCombo->addItems(QStringList() | ||
<< "COLORMAP_AUTUMN" | ||
<< "COLORMAP_BONE" | ||
<< "COLORMAP_JET" | ||
<< "COLORMAP_WINTER" | ||
<< "COLORMAP_RAINBOW" | ||
<< "COLORMAP_OCEAN" | ||
<< "COLORMAP_SUMMER" | ||
<< "COLORMAP_SPRING" | ||
<< "COLORMAP_COOL" | ||
<< "COLORMAP_HSV" | ||
<< "COLORMAP_PINK" | ||
<< "COLORMAP_HOT" | ||
<< "COLORMAP_PARULA"); | ||
|
||
connect(ui->colorMapCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(on_colorMapCombo_currentIndexChanged(int))); | ||
} | ||
|
||
void Color_Plugin::processImage(const cv::Mat &inputImage, cv::Mat &outputImage) | ||
{ | ||
using namespace cv; | ||
applyColorMap(inputImage, outputImage, ui->colorMapCombo->currentIndex()); | ||
} | ||
|
||
void Color_Plugin::on_colorMapCombo_currentIndexChanged(int index) | ||
{ | ||
Q_UNUSED(index); | ||
emit updateNeeded(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#ifndef COLOR_PLUGIN_H | ||
#define COLOR_PLUGIN_H | ||
|
||
#include "color_plugin_global.h" | ||
#include "cvplugininterface.h" | ||
|
||
namespace Ui { | ||
class PluginGui; | ||
} | ||
|
||
class COLOR_PLUGINSHARED_EXPORT Color_Plugin: public QObject, public CvPluginInterface | ||
{ | ||
Q_OBJECT | ||
Q_PLUGIN_METADATA(IID "com.computervision.cvplugininterface") | ||
Q_INTERFACES(CvPluginInterface) | ||
public: | ||
Color_Plugin(); | ||
~Color_Plugin(); | ||
|
||
QString title(); | ||
QString version(); | ||
QString description(); | ||
QString help(); | ||
void setupUi(QWidget *parent); | ||
void processImage(const cv::Mat &inputImage, cv::Mat &outputImage); | ||
|
||
signals: | ||
void updateNeeded(); | ||
void errorMessage(QString msg); | ||
void infoMessage(QString msg); | ||
|
||
private slots: | ||
void on_colorMapCombo_currentIndexChanged(int index); | ||
|
||
private: | ||
Ui::PluginGui *ui; | ||
|
||
}; | ||
|
||
#endif // COLOR_PLUGIN_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
|
||
QT += widgets | ||
|
||
TARGET = Color_Plugin | ||
TEMPLATE = lib | ||
|
||
CONFIG += plugin | ||
|
||
DEFINES += COLOR_PLUGIN_LIBRARY | ||
|
||
# The following define makes your compiler emit warnings if you use | ||
# any feature of Qt which as been marked as deprecated (the exact warnings | ||
# depend on your compiler). Please consult the documentation of the | ||
# deprecated API in order to know how to port your code away from it. | ||
DEFINES += QT_DEPRECATED_WARNINGS | ||
|
||
# You can also make your code fail to compile if you use deprecated APIs. | ||
# In order to do so, uncomment the following line. | ||
# You can also select to disable deprecated APIs only up to a certain version of Qt. | ||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 | ||
|
||
INCLUDEPATH += ../cvplugininterface | ||
|
||
SOURCES += \ | ||
color_plugin.cpp | ||
|
||
HEADERS += \ | ||
color_plugin.h \ | ||
color_plugin_global.h | ||
|
||
unix { | ||
target.path = /usr/lib | ||
INSTALLS += target | ||
} | ||
|
||
win32: { | ||
include("c:/dev/opencv/opencv.pri") | ||
} | ||
|
||
unix: !macx{ | ||
CONFIG += link_pkgconfig | ||
PKGCONFIG += opencv | ||
} | ||
|
||
unix: macx{ | ||
INCLUDEPATH += "/usr/local/include" | ||
LIBS += -L"/usr/local/lib" \ | ||
-lopencv_world | ||
} | ||
|
||
FORMS += \ | ||
plugin.ui |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#ifndef COLOR_PLUGIN_GLOBAL_H | ||
#define COLOR_PLUGIN_GLOBAL_H | ||
|
||
#include <QtCore/qglobal.h> | ||
|
||
#if defined(COLOR_PLUGIN_LIBRARY) | ||
# define COLOR_PLUGINSHARED_EXPORT Q_DECL_EXPORT | ||
#else | ||
# define COLOR_PLUGINSHARED_EXPORT Q_DECL_IMPORT | ||
#endif | ||
|
||
#endif // COLOR_PLUGIN_GLOBAL_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>PluginGui</class> | ||
<widget class="QWidget" name="PluginGui"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>319</width> | ||
<height>530</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Form</string> | ||
</property> | ||
<layout class="QGridLayout" name="gridLayout"> | ||
<item row="0" column="0"> | ||
<widget class="QLabel" name="label"> | ||
<property name="sizePolicy"> | ||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred"> | ||
<horstretch>0</horstretch> | ||
<verstretch>0</verstretch> | ||
</sizepolicy> | ||
</property> | ||
<property name="text"> | ||
<string>Color Maps :</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="0" column="1"> | ||
<widget class="QComboBox" name="colorMapCombo"/> | ||
</item> | ||
</layout> | ||
</widget> | ||
<resources/> | ||
<connections/> | ||
</ui> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
TEMPLATE = subdirs | ||
SUBDIRS += \ | ||
mainapp \ | ||
template_plugin \ | ||
copymakeborder_plugin \ | ||
filter_plugin \ | ||
transform_plugin \ | ||
color_plugin \ | ||
segmentation_plugin \ | ||
keypoint_plugin |
70 changes: 70 additions & 0 deletions
70
computer_vision/copymakeborder_plugin/copymakeborder_plugin.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#include "copymakeborder_plugin.h" | ||
|
||
#include "ui_plugin.h" | ||
|
||
CopyMakeBorder_Plugin::CopyMakeBorder_Plugin() | ||
{ | ||
// Insert initialization codes here ... | ||
} | ||
|
||
CopyMakeBorder_Plugin::~CopyMakeBorder_Plugin() | ||
{ | ||
// Insert cleanup codes here ... | ||
} | ||
|
||
QString CopyMakeBorder_Plugin::title() | ||
{ | ||
return this->metaObject()->className(); | ||
} | ||
|
||
QString CopyMakeBorder_Plugin::version() | ||
{ | ||
return "1.0.0"; | ||
} | ||
|
||
QString CopyMakeBorder_Plugin::description() | ||
{ | ||
return ""; | ||
} | ||
|
||
QString CopyMakeBorder_Plugin::help() | ||
{ | ||
return ""; | ||
} | ||
|
||
void CopyMakeBorder_Plugin::setupUi(QWidget *parent) | ||
{ | ||
ui = new Ui::PluginGui; | ||
ui->setupUi(parent); | ||
QStringList items; | ||
items.append("BORDER_CONSTANT"); | ||
items.append("BORDER_REPLICATE"); | ||
items.append("BORDER_REFLECT"); | ||
items.append("BORDER_WRAP"); | ||
items.append("BORDER_REFLECT_101"); | ||
ui->borderTypeComboBox->addItems(items); | ||
connect(ui->borderTypeComboBox, | ||
SIGNAL(currentIndexChanged(int)), | ||
this, | ||
SLOT(on_borderTypeComboBox_currentIndexChanged(int))); | ||
} | ||
|
||
void CopyMakeBorder_Plugin::processImage(const cv::Mat &inputImage, cv::Mat &outputImage) | ||
{ | ||
int top, bot, left, right; | ||
top = bot = inputImage.rows/2; | ||
left = right = inputImage.cols/2; | ||
cv::copyMakeBorder(inputImage, | ||
outputImage, | ||
top, | ||
bot, | ||
left, | ||
right, | ||
ui->borderTypeComboBox->currentIndex()); | ||
} | ||
|
||
void CopyMakeBorder_Plugin::on_borderTypeComboBox_currentIndexChanged(int index) | ||
{ | ||
Q_UNUSED(index); | ||
emit updateNeeded(); | ||
} |
40 changes: 40 additions & 0 deletions
40
computer_vision/copymakeborder_plugin/copymakeborder_plugin.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#ifndef COPYMAKEBORDER_PLUGIN_H | ||
#define COPYMAKEBORDER_PLUGIN_H | ||
|
||
#include "copymakeborder_plugin_global.h" | ||
#include "cvplugininterface.h" | ||
|
||
namespace Ui { | ||
class PluginGui; | ||
} | ||
|
||
class COPYMAKEBORDER_PLUGINSHARED_EXPORT CopyMakeBorder_Plugin: public QObject, public CvPluginInterface | ||
{ | ||
Q_OBJECT | ||
Q_PLUGIN_METADATA(IID "com.computervision.cvplugininterface") | ||
Q_INTERFACES(CvPluginInterface) | ||
public: | ||
CopyMakeBorder_Plugin(); | ||
~CopyMakeBorder_Plugin(); | ||
|
||
QString title(); | ||
QString version(); | ||
QString description(); | ||
QString help(); | ||
void setupUi(QWidget *parent); | ||
void processImage(const cv::Mat &inputImage, cv::Mat &outputImage); | ||
|
||
signals: | ||
void updateNeeded(); | ||
void errorMessage(QString msg); | ||
void infoMessage(QString msg); | ||
|
||
private slots: | ||
void on_borderTypeComboBox_currentIndexChanged(int index); | ||
|
||
private: | ||
Ui::PluginGui *ui; | ||
|
||
}; | ||
|
||
#endif // COPYMAKEBORDER_PLUGIN_H |
51 changes: 51 additions & 0 deletions
51
computer_vision/copymakeborder_plugin/copymakeborder_plugin.pro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
|
||
QT += widgets | ||
|
||
TARGET = CopyMakeBorder_Plugin | ||
TEMPLATE = lib | ||
|
||
CONFIG += plugin | ||
|
||
DEFINES += COPYMAKEBORDER_PLUGIN_LIBRARY | ||
|
||
# The following define makes your compiler emit warnings if you use | ||
# any feature of Qt which as been marked as deprecated (the exact warnings | ||
# depend on your compiler). Please consult the documentation of the | ||
# deprecated API in order to know how to port your code away from it. | ||
DEFINES += QT_DEPRECATED_WARNINGS | ||
|
||
# You can also make your code fail to compile if you use deprecated APIs. | ||
# In order to do so, uncomment the following line. | ||
# You can also select to disable deprecated APIs only up to a certain version of Qt. | ||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 | ||
|
||
INCLUDEPATH += ../cvplugininterface | ||
|
||
SOURCES += \ | ||
copymakeborder_plugin.cpp | ||
HEADERS += \ | ||
copymakeborder_plugin.h \ | ||
copymakeborder_plugin_global.h | ||
|
||
unix { | ||
target.path = /usr/lib | ||
INSTALLS += target | ||
} | ||
|
||
win32: { | ||
include("c:/dev/opencv/opencv.pri") | ||
} | ||
|
||
unix: !macx{ | ||
CONFIG += link_pkgconfig | ||
PKGCONFIG += opencv | ||
} | ||
|
||
unix: macx{ | ||
INCLUDEPATH += "/usr/local/include" | ||
LIBS += -L"/usr/local/lib" \ | ||
-lopencv_world | ||
} | ||
|
||
FORMS += \ | ||
plugin.ui |
Oops, something went wrong.