-
simon.fanetti authoredsimon.fanetti authored
projection.h 1.85 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;
cv::Point2f fxy;
cv::Point2f ppxy;
void deprojectPixelsFromDepth(cv::Mat_<float> &depth, Camera *camera, cv::Point3f beamer_pos, cv::Mat_<cv::Point2i> &deprojectMap, cv::Point2f fxy, cv::Point2f ppxy);
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, cv::Point2f fxy, cv::Point2f ppxy);
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