Object Detection  5.0
Image Processing Using Qt and Opencv
colordetectorcontroller.h
1 #ifndef COLORDETECTORCONTROLLER_H
2 #define COLORDETECTORCONTROLLER_H
3 
4 #include <QObject>
5 #include "ImageProcessor/abstractimageprocessor.h"
6 #include "ImageProcessor/objectdetection.h"
7 #include <QImage>
8 #include "Utilities/utils.h"
9 class ColorDetectorController : public QObject
10 {
11  Q_OBJECT
12 // Q_PROPERTY(int minColor READ getMinColor WRITE setMinColor NOTIFY minColorChanged)
13 public:
14  explicit ColorDetectorController(QObject *parent = nullptr);
15  cv::Mat colored;
16  cv::Mat dialted;
17  int getDilationSize() const;
18  int getThickCircle() const;
19  cv::Scalar getMinColor() const;
20  cv::Scalar getMaxColor() const;
21  int getParam1() const;
22  int getParam2() const;
23  int getMinDist() const;
24  cv::Scalar getCircleColor() const;
25  void setCircleColor(const cv::Scalar &value);
26 
27  int getThickness() const;
28  ObjectDetection *getPro() const;
29 
30 public slots:
31  void setParam1(int value);
32  void setParam2(int value);
33  void setMinDist(int value);
34  void setThickness(int value);
35 
36  void setPro(ObjectDetection *value);
37 
38 signals:
39  void dilationSizeChanged(int);
40  void minColorChanged(const cv::Scalar&);
41  void maxColorChanged(const cv::Scalar&);
42  void param1Changed(int);
43  void param2Changed(int);
44  void minDistChanged(int);
45  void xyrChanged(int, int, int);
46 
47 private:
48  int thickness = 2;
49  cv::Scalar circleColor = cv::Scalar(0, 255, 0);
50  cv::Scalar minColor;
51  cv::Scalar maxColor;
52  int param1, param2, minDist, dilationSize;
53  ObjectDetection *pro;
54 public slots:
55  void addFilter(PluginSharedPointer filter);
56  void setDilationSize(int value);
57  void setMinColor(const cv::Scalar &value);
58  void setMaxColor(const cv::Scalar &value);
59  Q_INVOKABLE QImage detectObject(const cv::Mat &t);
60 
61 };
62 
63 #endif // COLORDETECTORCONTROLLER_H
this class is used to detect a a colored circle object(s)