17#include <QCoreApplication>
20#include <QMutexLocker>
25#include "semanticsegmentation_global.h"
26#include "itransform.h"
27#include "settingswidget.h"
32#include <opencv2/opencv.hpp>
33#include <opencv2/core/ocl.hpp>
43#define MODEL_PATH "/plugins/resources/neural_network_models"
44#define HW_NAME(x) x ? "Using GPU (cuda)" : "Using CPU"
45#define USED_MODEL "Used Model"
46#define SELECTED_CLASSES "Selected classes"
65 Q_PLUGIN_METADATA(IID
"iVS3D.ITransform")
88 QString
getName()
const override;
108 TransformResult
transform(uint idx,
const cv::Mat &img,
const Resolution &resolution,
const ROI &roi)
override;
120 void setSettings(QMap<QString, QVariant> settings)
override;
145 void sig_message(QString processor, QString message =
"",
bool active =
true);
147 void sig_error(QString message);
151 void slot_ONNXindexChanged(
int n);
152 void slot_selectedClassesChanged(QBoolList classes);
153 void slot_blendAlphaChanged(
float alpha);
164 std::vector<float> mean, std;
165 std::vector<ClassInfo> classes;
168 bool loadModelInfo();
174 void sendGuiPreview();
177 QStringList m_ONNXmodelList;
180 QBoolList m_ONNXselectedClasses;
184 cv::Mat m_originalImage;
189 cv::Mat m_segmentationColorized;
190 cv::Mat m_segmentationMask;
194 bool m_updateClasses =
true;
197 void alphaBlend(
const cv::Mat &foreground,
const cv::Mat &background, cv::Mat &destionation,
float alpha);
199 bool computeColorization();
202 Error createError(
const QString &message);
Factory class for creating NeuralNet instances.
Contains the Tensor class for representing N-dimensional arrays with various data types.
A Tensor represents a N-dimensional array containing elements of the same type. Can be used as input ...
Definition Tensor.h:201
The ROI class manages a region of interest represented as a rectangle in the [0,1]x[0,...
Definition roi.h:21
The Resolution class encapsulates an image resolution (width and height). It provides functionality f...
Definition resolution.h:17
The SemanticSegmentation class is used to create binary masks for the reconstruction....
Definition semanticsegmentation.h:63
void sig_classesAndColorsChanged(QStringList classes, QColorList colors, QBoolList selectedClasses)
[signal] sig_classesAndColorsChanged is emitted if a new model with different classes and colors is s...
void sig_message(QString processor, QString message="", bool active=true)
[signal] sig_message is emmitted if the algorithm has a message for the user to display.
std::shared_ptr< NeuralNet > NeuralNetPtr
Smart pointer type for managing NeuralNet instances.
Definition NeuralNet.h:95
Definition semanticsegmentation.h:157
Definition semanticsegmentation.h:163