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
3f294a9f
Commit
3f294a9f
authored
4 years ago
by
simon.fanetti
Browse files
Options
Downloads
Patches
Plain Diff
Sandbox init return int status
parent
dfb518d3
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
inc/sandbox.h
+1
-1
1 addition, 1 deletion
inc/sandbox.h
src/components/camera.cpp
+1
-1
1 addition, 1 deletion
src/components/camera.cpp
src/components/projection.cpp
+20
-2
20 additions, 2 deletions
src/components/projection.cpp
src/lib/sandbox.cpp
+2
-2
2 additions, 2 deletions
src/lib/sandbox.cpp
with
24 additions
and
6 deletions
inc/sandbox.h
+
1
−
1
View file @
3f294a9f
...
...
@@ -22,7 +22,7 @@ class Sandbox{
Beamer
*
getBeamer
(){
return
beamer
;
};
Projection
*
getProjection
(){
return
projection
;
};
void
init
();
int
init
();
void
captureFrame
();
cv
::
Mat
getColorFrame
();
cv
::
Mat
getDepthFrame
();
...
...
This diff is collapsed.
Click to expand it.
src/components/camera.cpp
+
1
−
1
View file @
3f294a9f
...
...
@@ -32,7 +32,7 @@ Camera::~Camera(){
int
Camera
::
start
(){
// check for a device avail
i
ble
// check for a device avail
a
ble
if
(
!
cfg
->
can_resolve
(
*
pipe
)){
//std::cout << "Error: No device found" << std::endl;
return
1
;
...
...
This diff is collapsed.
Click to expand it.
src/components/projection.cpp
+
20
−
2
View file @
3f294a9f
#include
"../../inc/projection.h"
/*
* MAIN
*/
Projection
::
Projection
(){
adjustingMatrix
=
cv
::
getRotationMatrix2D
(
cv
::
Point
(
0
,
0
),
0
,
1
);
distanceTopSandbox
=
1.0
f
;
...
...
@@ -14,8 +18,7 @@ cv::Point2i Projection::rotatePixel(cv::Point2i pixel){
return
cv
::
Point2i
(
tmp
.
at
<
cv
::
Vec2f
>
(
0
,
0
));
}
// Adjust the projected frame with the topology from the camera to the beamer POV
void
Projection
::
adjustFrame
(
cv
::
Mat
depth
,
cv
::
Mat
src
,
cv
::
Mat
&
dst
,
Camera
*
camera
,
cv
::
Point3f
beamer_pos
){
cv
::
Rect
mask
=
camera
->
getCroppingMask
();
...
...
@@ -40,6 +43,12 @@ void Projection::adjustFrame(cv::Mat depth, cv::Mat src, cv::Mat &dst, Camera *c
cv
::
warpAffine
(
dst
,
dst
,
adjustingMatrix
,
dst
.
size
());
}
/*
* PRIVATE
*/
void
Projection
::
deprojectPixelsFromDepth
(
cv
::
Mat
&
depth
,
cv
::
Rect
mask
,
Camera
*
camera
,
cv
::
Point3f
beamer_pos
,
cv
::
Mat
&
pixelsDeprojectMap
){
// Browse the depth frame matching the cropping mask
...
...
@@ -64,6 +73,7 @@ void Projection::deprojectPixelsFromDepth(cv::Mat &depth, cv::Rect mask, Camera
}
}
void
Projection
::
filterHighestDeprojectedPoints
(
cv
::
Mat
&
depth
,
cv
::
Mat
&
pixelsDeprojectMap
,
cv
::
Mat
&
pixelsDeprojectHighestMap
){
for
(
int
j
=
0
;
j
<
pixelsDeprojectMap
.
rows
;
j
++
){
...
...
@@ -84,6 +94,7 @@ void Projection::filterHighestDeprojectedPoints(cv::Mat &depth, cv::Mat &pixelsD
}
}
void
Projection
::
buildFrame
(
cv
::
Mat
&
depth
,
cv
::
Mat
&
pixelsDeprojectHighestMap
,
cv
::
Mat
&
src
,
cv
::
Mat
&
dst
){
for
(
int
j
=
0
;
j
<
pixelsDeprojectHighestMap
.
rows
;
j
++
){
...
...
@@ -99,6 +110,7 @@ void Projection::buildFrame(cv::Mat &depth, cv::Mat &pixelsDeprojectHighestMap,
}
}
cv
::
Size
Projection
::
getMatchingSize
(
cv
::
Mat
&
src
,
cv
::
Rect
base
){
cv
::
Size
bigSize
;
bigSize
.
width
=
(
src
.
size
().
width
%
base
.
width
==
0
)
?
src
.
size
().
width
:
src
.
size
().
width
-
(
src
.
size
().
width
%
base
.
width
)
+
base
.
width
;
...
...
@@ -106,6 +118,7 @@ cv::Size Projection::getMatchingSize(cv::Mat &src, cv::Rect base){
return
bigSize
;
}
// pixels coordinates are relative to the camera depth frame
void
Projection
::
copyPixelsInto
(
cv
::
Point2i
pixel_dst
,
cv
::
Mat
&
dst
,
cv
::
Point2i
pixel_src
,
cv
::
Mat
&
src
,
cv
::
Mat
&
depth
){
...
...
@@ -130,6 +143,7 @@ void Projection::copyPixelsInto(cv::Point2i pixel_dst, cv::Mat &dst, cv::Point2i
}
}
/*
C : Camera position
B : Beamer position
...
...
@@ -154,6 +168,10 @@ cv::Point2i Projection::findMatchingPixel(int i, int j, float z, Camera *camera,
}
/*
* Debug
*/
void
Projection
::
printAdjustingMatrix
(){
cv
::
Mat
matrix
=
getAdjustingMatrix
();
...
...
This diff is collapsed.
Click to expand it.
src/lib/sandbox.cpp
+
2
−
2
View file @
3f294a9f
...
...
@@ -22,8 +22,8 @@ Sandbox::~Sandbox(){
* PUBLIC
*/
void
Sandbox
::
init
(){
camera
->
start
();
int
Sandbox
::
init
(){
return
camera
->
start
();
}
void
Sandbox
::
captureFrame
(){
...
...
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