Skip to content
Snippets Groups Projects
Select Git revision
  • 51c3c2541d607c5ec15b09c2f82fae4a56329873
  • master default protected
  • dev
  • node_server
  • falcone
  • feature_refractoring
  • bowyer-watson-port
7 results

main.rs

Blame
  • projection.h 1.95 KiB
    #ifndef SANDBOX_PROJECTION_H
    #define SANDBOX_PROJECTION_H
    
    #include <opencv2/opencv.hpp>
    #include "beamer.h"
    #include "camera.h"
    
    class Projection{
        private:
            cv::Mat adjustingMatrix;
            float distanceTopSandbox;
            // Buffer for the builded virtual frame, which is scaled to n * depth_frame.size for the building process
            cv::Mat_<cv::Vec3b> resized_dst;
            // Buffer containing the pixels's new location when deprojected to beamer's POV
            cv::Mat_<cv::Point2i> deprojectMap;
            // Buffer indicating from where to get the pixels in the source frame
            cv::Mat_<cv::Point2i> frameMap;
    
            void deprojectPixelsFromDepth(cv::Mat_<float> &depth, cv::Rect mask, Camera *camera, cv::Point3f beamer_pos, cv::Mat_<cv::Point2i> &deprojectMap);
            void filterLowestDeprojectedPoints(cv::Mat_<float> &depth, cv::Mat_<cv::Point2i> &deprojectMap, cv::Mat_<cv::Point2i> &frameMap);
            void buildFrame(cv::Mat_<float> &depth, cv::Mat_<cv::Point2i> &frameMap, cv::Mat_<cv::Vec3b> &src, cv::Mat_<cv::Vec3b> &dst);
            cv::Point2i findMatchingPixel(int i, int j, float z, Camera *camera, cv::Point3f beamer_pos);
            void copyPixelsInto(cv::Point2i pixel_dst, cv::Mat_<cv::Vec3b> &dst, cv::Point2i pixel_src, cv::Mat_<cv::Vec3b> &src, cv::Mat_<float> &depth);
            cv::Size getMatchingSize(cv::Mat &src, cv::Mat &base);
    
        public:
            Projection();
    
            void setAdjustingMatrix(cv::Mat matrix){ adjustingMatrix = matrix; }
            cv::Mat getAdjustingMatrix(){ return adjustingMatrix; }
            void setDistanceTopSandbox(float dist){ distanceTopSandbox = dist; };
            float getDistanceTopSandbox(){ return distanceTopSandbox; };
    
            cv::Point2i rotatePixel(cv::Point2i pixel);
            cv::Point2i revertRotatePixel(cv::Point2i pixel);
            void adjustFrame(cv::Mat_<float> depth, cv::Mat_<cv::Vec3b> src, cv::Mat_<cv::Vec3b> &dst, Camera *camera, cv::Point3f beamer_pos);
            void printAdjustingMatrix();
    
    };
    #endif