Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
#ifndef DEPTHPROCESSOR_H#define DEPTHPROCESSOR_H#include "GlobalDefines.h"// Divisor for visualizing the depth image (16->8 bits)#define SCALE_DIVISOR 16// Field of view to generate horizontal map from#define VFOV_MIN 100#define VFOV_MAX 140// Threshold for moving object recognition#define FG_MASK_THRESHOLD 220// Parameters for the background subtractor#define BACKGROUND_SUBTRACTOR_HISTORY 150#define BACKGROUND_SUBTRACTOR_NMIXTURES 1// Parameters for blob detection#define BLOB_MIN_DISTANCE 30#define BLOB_MIN_AREA 20#define BLOB_MAX_AREA 9999// Multiplier for velocity line indicator#define VELOCITY_MULTIPLIER 5// Indicator colors#define COLOR_DEPTH_FOV QColor(255, 255, 255, 100)#define COLOR_DEPTH_FOV_FILL QColor(0, 0, 0, 100)#define COLOR_DEPTH_POINT QColor(0, 0, 255, 255)#define COLOR_DEPTH_BACKGROUND QColor(255, 0, 0, 10)#define COLOR_FOV QColor(0, 0, 0, 100)#define COLOR_MOVEMENT_ZONE QColor(255, 0, 0, 5)#define COLOR_KEYPOINT QColor(255, 255, 0, 200)#define COLOR_EST_POSITION QColor(0, 0, 255, 200)#define COLOR_EST_AVGERAGE QColor(0, 255, 0, 200)class DepthProcessor : public QThread{Q_OBJECTpublic:DepthProcessor(QObject *parent = 0);~DepthProcessor();public slots:void setFOV(float width, float height);void setDisplayImage(const int, const QString &);void processDepthData(const cv::Mat &);signals:void setImageTopLeft(const QImage &);void setImageTopRight(const QImage &);void setImageBotLeft(const QImage &);void setImageBotRight(const QImage &);private:// Pointer to images to be displayed on the GUIQImage *topLeftImage;QImage *topRightImage;QImage *botLeftImage;QImage *botRightImage;void updateImages();void drawDepthImages();void drawFOVImages();void drawDistanceFOV(QImage &, QVector<float> &);void drawSensorFOV(QImage &image);void drawMovementZones(QImage &, QVector<float> &);void drawKeyPoints(QImage &image, std::vector<cv::KeyPoint> &);void drawMovingObjects(QImage &, std::vector<MOVING_OBJECT> &);void convertMatToQImage3C(cv::Mat &, QImage &);void convertQImageToMat3C(QImage &, cv::Mat &);float fovWidth;float fovHeight;cv::Mat rawData16; // Raw 16-bit sensor dataQImage rawDepthImage; // Image of --^cv::Mat lastValidData16; // Last known valid 16-bit dataQImage lastValidDepthImage; // Image of --^QImage lastValidProcessed; // Processed image with overlaycv::Mat fgMaskMOG; // Mask of detected movementsQImage movementMaskImage; // Image of --^cv::Mat fgMaskTmp; // Temporary buffer for averaging mask valuescv::Mat fgMaskRaw; // Raw values for movement maskQImage movementMaskRawImage; // Image of --^cv::Mat fgMaskAverage; // Weighted average of mask valuesQImage movementMaskAverageImage; // Image of --^cv::Ptr<cv::BackgroundSubtractor> pMOG; // Background subtractorQImage rawHorizonImage; // 2D image showing depth points (raw)QImage lastValidHorizonImage; // 2D image showing depth pointsQImage overlayHorizonImage; // 2D image with all overlaysQVector<float> rawDepthHorizon; // Depth points in inches (raw)QVector<float> depthHorizon; // Depth points in inchesQVector<int> movementMaskHorizon; // 1D condensed movement maskcv::Mat movementPointsMat; // Image showing object movement zonesQImage movementPointsImage; // Image of --^cv::SimpleBlobDetector::Params params; // Parameters for blob detectioncv::Ptr<cv::FeatureDetector> blobDetector; // Blob detectorstd::vector<cv::KeyPoint> blobKeypoints; // Keypoints from blob detectorMovingPointTracker movementTracker; // Movement trackerstd::vector<MOVING_OBJECT> movementObjects; // Results from movement tracker};#endif // DEPTHPROCESSOR_H