Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ar_sandbox_lib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AR_Sandbox
ar_sandbox_lib
Commits
acd4c994
Commit
acd4c994
authored
4 years ago
by
simon.fanetti
Browse files
Options
Downloads
Patches
Plain Diff
debug
parent
bbf24a10
No related branches found
No related tags found
1 merge request
!3
Custom realsense
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
inc/projection.h
+3
-3
3 additions, 3 deletions
inc/projection.h
inc/sandbox.h
+3
-2
3 additions, 2 deletions
inc/sandbox.h
src/components/projection.cpp
+20
-3
20 additions, 3 deletions
src/components/projection.cpp
src/lib/sandbox.cpp
+11
-8
11 additions, 8 deletions
src/lib/sandbox.cpp
with
37 additions
and
16 deletions
inc/projection.h
+
3
−
3
View file @
acd4c994
...
...
@@ -7,7 +7,7 @@
class
Projection
{
private:
cv
::
Mat
adjustingMatrix
;
cv
::
Mat
_
<
float
>
adjustingMatrix
;
float
distanceTopSandbox
;
cv
::
Mat_
<
float
>
resized_depth
;
...
...
@@ -28,14 +28,14 @@ class Projection{
public:
Projection
();
void
setAdjustingMatrix
(
cv
::
Mat
matrix
){
adjustingMatrix
=
matrix
;
}
void
setAdjustingMatrix
(
cv
::
Mat
_
<
float
>
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
adjustFrame
(
cv
::
Mat_
<
float
>
&
depth
,
cv
::
Mat_
<
cv
::
Vec3b
>
&
src
,
cv
::
Mat_
<
cv
::
Vec3b
>
&
dst
,
Camera
*
camera
,
cv
::
Point3f
beamer_pos
);
void
printAdjustingMatrix
();
};
...
...
This diff is collapsed.
Click to expand it.
inc/sandbox.h
+
3
−
2
View file @
acd4c994
...
...
@@ -13,6 +13,7 @@ class Sandbox{
Projection
*
projection
;
Camera
*
camera
;
Beamer
*
beamer
;
cv
::
Mat_
<
cv
::
Vec3b
>
projectedFrame
;
public:
Sandbox
();
...
...
@@ -26,8 +27,8 @@ class Sandbox{
void
captureFrame
();
cv
::
Mat_
<
cv
::
Vec3b
>
getColorFrame
();
cv
::
Mat_
<
float
>
getDepthFrame
();
cv
::
Mat_
<
cv
::
Vec3b
>
adjustProjection
(
cv
::
Mat_
<
cv
::
Vec3b
>
frame
);
cv
::
Mat_
<
cv
::
Vec3b
>
adjustProjection
(
cv
::
Mat_
<
cv
::
Vec3b
>
frame
,
cv
::
Mat_
<
float
>
depth
);
cv
::
Mat_
<
cv
::
Vec3b
>
adjustProjection
(
cv
::
Mat_
<
cv
::
Vec3b
>
&
frame
);
cv
::
Mat_
<
cv
::
Vec3b
>
adjustProjection
(
cv
::
Mat_
<
cv
::
Vec3b
>
&
frame
,
cv
::
Mat_
<
float
>
&
depth
);
int
loadConfig
();
int
loadConfigFrom
(
char
*
path
);
...
...
This diff is collapsed.
Click to expand it.
src/components/projection.cpp
+
20
−
3
View file @
acd4c994
#include
"../../inc/projection.h"
#include
<chrono>
/*
* MAIN
...
...
@@ -30,15 +30,16 @@ cv::Point2i Projection::revertRotatePixel(cv::Point2i pixel){
/*
Adjust the projected frame with the topology from the camera to the beamer POV
*/
void
Projection
::
adjustFrame
(
cv
::
Mat_
<
float
>
depth
,
cv
::
Mat_
<
cv
::
Vec3b
>
src
,
cv
::
Mat_
<
cv
::
Vec3b
>
&
dst
,
Camera
*
camera
,
cv
::
Point3f
beamer_pos
){
void
Projection
::
adjustFrame
(
cv
::
Mat_
<
float
>
&
depth
,
cv
::
Mat_
<
cv
::
Vec3b
>
&
src
,
cv
::
Mat_
<
cv
::
Vec3b
>
&
dst
,
Camera
*
camera
,
cv
::
Point3f
beamer_pos
){
if
(
deprojectMap
.
empty
()
||
deprojectMap
.
size
()
!=
d
epth
.
size
()){
if
(
deprojectMap
.
empty
()
||
deprojectMap
.
size
()
!=
d
st
.
size
()){
if
(
!
deprojectMap
.
empty
()){
deprojectMap
.
release
();
frameMap
.
release
();
resized_depth
.
release
();
resized_src
.
release
();
}
std
::
cout
<<
"Create"
<<
std
::
endl
;
deprojectMap
.
create
(
dst
.
rows
,
dst
.
cols
);
frameMap
.
create
(
dst
.
rows
,
dst
.
cols
);
resized_depth
.
create
(
dst
.
rows
,
dst
.
cols
);
...
...
@@ -57,9 +58,25 @@ void Projection::adjustFrame(cv::Mat_<float> depth, cv::Mat_<cv::Vec3b> src, cv:
cv
::
resize
(
src
,
resized_src
,
dst
.
size
());
cv
::
resize
(
depth
,
resized_depth
,
dst
.
size
());
// 75 ms
//std::chrono::milliseconds start_ms = std::chrono::duration_cast< std::chrono::milliseconds >( std::chrono::system_clock::now().time_since_epoch() );
deprojectPixelsFromDepth
(
resized_depth
,
camera
,
camera
->
getCroppingMask
()
,
beamer_pos
,
deprojectMap
,
fxy
,
ppxy
);
//std::chrono::milliseconds now_ms = std::chrono::duration_cast< std::chrono::milliseconds >( std::chrono::system_clock::now().time_since_epoch() );
//std::cout << "Deproject : " << (now_ms - start_ms).count() << std::endl;
// 18-19 ms
//start_ms = std::chrono::duration_cast< std::chrono::milliseconds >( std::chrono::system_clock::now().time_since_epoch() );
filterLowestDeprojectedPoints
(
resized_depth
,
deprojectMap
,
frameMap
);
//now_ms = std::chrono::duration_cast< std::chrono::milliseconds >( std::chrono::system_clock::now().time_since_epoch() );
//std::cout << "Filter : " << (now_ms - start_ms).count() << std::endl;
// 14-15 ms
//start_ms = std::chrono::duration_cast< std::chrono::milliseconds >( std::chrono::system_clock::now().time_since_epoch() );
buildFrame
(
resized_depth
,
frameMap
,
resized_src
,
dst
);
//now_ms = std::chrono::duration_cast< std::chrono::milliseconds >( std::chrono::system_clock::now().time_since_epoch() );
//std::cout << "Build : " << (now_ms - start_ms).count() << std::endl;
cv
::
warpAffine
(
dst
,
dst
,
adjustingMatrix
,
dst
.
size
());
}
...
...
This diff is collapsed.
Click to expand it.
src/lib/sandbox.cpp
+
11
−
8
View file @
acd4c994
...
...
@@ -38,20 +38,23 @@ cv::Mat_<float> Sandbox::getDepthFrame(){
return
camera
->
getDepthFrame
()(
camera
->
getCroppingMask
());
}
cv
::
Mat_
<
cv
::
Vec3b
>
Sandbox
::
adjustProjection
(
cv
::
Mat_
<
cv
::
Vec3b
>
frame
,
cv
::
Mat_
<
float
>
depth
){
cv
::
Mat_
<
cv
::
Vec3b
>
Sandbox
::
adjustProjection
(
cv
::
Mat_
<
cv
::
Vec3b
>
&
frame
,
cv
::
Mat_
<
float
>
&
depth
){
static
cv
::
Mat_
<
cv
::
Vec3b
>
imageCalibrate
=
cv
::
Mat_
<
cv
::
Vec3b
>
(
cv
::
Size
(
beamer
->
getWidth
(),
beamer
->
getHeight
()));
imageCalibrate
=
cv
::
Vec3b
(
0
,
0
,
0
);
projection
->
adjustFrame
(
depth
,
frame
,
imageCalibrate
,
camera
,
beamer
->
getPosition
());
if
(
projectedFrame
.
empty
()){
projectedFrame
.
create
(
beamer
->
getHeight
(),
beamer
->
getWidth
());
}
projectedFrame
=
cv
::
Vec3b
(
0
,
0
,
0
);
projection
->
adjustFrame
(
depth
,
frame
,
projectedFrame
,
camera
,
beamer
->
getPosition
());
// frame after process
//cv::dilate(
imageCalib
ra
t
e,
imageCalib
ra
t
e, cv::Mat(), cv::Point(-1, -1), 2, 1, 1);
//cv::erode(
imageCalib
ra
t
e,
imageCalib
ra
t
e, cv::Mat(), cv::Point(-1, -1), 2, 1, 1);
//cv::dilate(
projectedF
ra
m
e,
projectedF
ra
m
e, cv::Mat(), cv::Point(-1, -1), 2, 1, 1);
//cv::erode(
projectedF
ra
m
e,
projectedF
ra
m
e, cv::Mat(), cv::Point(-1, -1), 2, 1, 1);
return
imageCalib
ra
t
e
;
return
projectedF
ra
m
e
;
}
cv
::
Mat_
<
cv
::
Vec3b
>
Sandbox
::
adjustProjection
(
cv
::
Mat_
<
cv
::
Vec3b
>
frame
){
cv
::
Mat_
<
cv
::
Vec3b
>
Sandbox
::
adjustProjection
(
cv
::
Mat_
<
cv
::
Vec3b
>
&
frame
){
captureFrame
();
cv
::
Mat_
<
float
>
depth
=
getDepthFrame
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment