Skip to content
Snippets Groups Projects
Commit 571f6925 authored by simon.fanetti's avatar simon.fanetti
Browse files

update static buffers in projection

parent 3a3aa518
No related branches found
No related tags found
1 merge request!3Custom realsense
...@@ -9,8 +9,9 @@ class Projection{ ...@@ -9,8 +9,9 @@ class Projection{
private: private:
cv::Mat adjustingMatrix; cv::Mat adjustingMatrix;
float distanceTopSandbox; 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; cv::Mat_<float> resized_depth;
cv::Mat_<cv::Vec3b> resized_src;
// Buffer containing the pixels's new location when deprojected to beamer's POV // Buffer containing the pixels's new location when deprojected to beamer's POV
cv::Mat_<cv::Point2i> deprojectMap; cv::Mat_<cv::Point2i> deprojectMap;
// Buffer indicating from where to get the pixels in the source frame // Buffer indicating from where to get the pixels in the source frame
......
...@@ -36,11 +36,13 @@ void Projection::adjustFrame(cv::Mat_<float> depth, cv::Mat_<cv::Vec3b> src, cv: ...@@ -36,11 +36,13 @@ void Projection::adjustFrame(cv::Mat_<float> depth, cv::Mat_<cv::Vec3b> src, cv:
if(!deprojectMap.empty()){ if(!deprojectMap.empty()){
deprojectMap.release(); deprojectMap.release();
frameMap.release(); frameMap.release();
resized_dst.release(); resized_depth.release();
resized_src.release();
} }
deprojectMap.create(dst.rows, dst.cols); deprojectMap.create(dst.rows, dst.cols);
frameMap.create(dst.rows, dst.cols); frameMap.create(dst.rows, dst.cols);
resized_dst.create(dst.rows, dst.cols); resized_depth.create(dst.rows, dst.cols);
resized_src.create(dst.rows, dst.cols);
std::vector<cv::Point2f> profil = camera->getAdaptedIntrinsics(dst); std::vector<cv::Point2f> profil = camera->getAdaptedIntrinsics(dst);
fxy = profil.at(0); fxy = profil.at(0);
...@@ -49,18 +51,18 @@ void Projection::adjustFrame(cv::Mat_<float> depth, cv::Mat_<cv::Vec3b> src, cv: ...@@ -49,18 +51,18 @@ void Projection::adjustFrame(cv::Mat_<float> depth, cv::Mat_<cv::Vec3b> src, cv:
deprojectMap = cv::Point2i(-1,-1); deprojectMap = cv::Point2i(-1,-1);
frameMap = cv::Point2i(-1,-1); frameMap = cv::Point2i(-1,-1);
resized_dst = cv::Vec3b(0,0,0); resized_depth = 0.0f;
resized_src = cv::Vec3b(0,0,0);
// resize to match 1:1 ratio with resized_dst, since we'll do later: // resize to match 1:1 ratio with resized_dst, since we'll do later:
// resized_dst[i] = src[i] // resized_dst[i] = src[i]
cv::resize(src, src, dst.size()); cv::resize(src, resized_src, dst.size());
cv::resize(depth, depth, dst.size()); cv::resize(depth, resized_depth, dst.size());
deprojectPixelsFromDepth(depth, camera, camera->getCroppingMask() , beamer_pos, deprojectMap, fxy, ppxy); deprojectPixelsFromDepth(resized_depth, camera, camera->getCroppingMask() , beamer_pos, deprojectMap, fxy, ppxy);
filterLowestDeprojectedPoints(depth, deprojectMap, frameMap); filterLowestDeprojectedPoints(resized_depth, deprojectMap, frameMap);
buildFrame(depth, frameMap, src, resized_dst); buildFrame(resized_depth, frameMap, resized_src, dst);
cv::resize(resized_dst, dst, dst.size());
cv::warpAffine(dst, dst, adjustingMatrix, dst.size()); cv::warpAffine(dst, dst, adjustingMatrix, dst.size());
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment