Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
ftl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Nicolas Pope
ftl
Commits
d186df85
Commit
d186df85
authored
5 years ago
by
Sebastian Hahta
Browse files
Options
Downloads
Plain Diff
Merge branch 'feature/use_intrinsics' into 'master'
Feature/use intrinsics See merge request nicolas.pope/ftl!66
parents
654b3ddb
2c267f78
No related branches found
No related tags found
1 merge request
!66
Feature/use intrinsics
Pipeline
#12259
passed
5 years ago
Stage: all
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
components/rgbd-sources/src/calibrate.cpp
+32
-4
32 additions, 4 deletions
components/rgbd-sources/src/calibrate.cpp
components/rgbd-sources/src/calibrate.hpp
+2
-1
2 additions, 1 deletion
components/rgbd-sources/src/calibrate.hpp
with
34 additions
and
5 deletions
components/rgbd-sources/src/calibrate.cpp
+
32
−
4
View file @
d186df85
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
#include
<loguru.hpp>
#include
<loguru.hpp>
#include
<ftl/config.h>
#include
<ftl/config.h>
#include
<ftl/configuration.hpp>
#include
<ftl/configuration.hpp>
#include
<ftl/threads.hpp>
#include
<iostream>
#include
<iostream>
#include
<sstream>
#include
<sstream>
...
@@ -46,15 +47,42 @@ Calibrate::Calibrate(nlohmann::json &config, cv::Size image_size, cv::cuda::Stre
...
@@ -46,15 +47,42 @@ Calibrate::Calibrate(nlohmann::json &config, cv::Size image_size, cv::cuda::Stre
calibrated_
=
_loadCalibration
(
image_size
,
map1
,
map2
);
calibrated_
=
_loadCalibration
(
image_size
,
map1
,
map2
);
if
(
calibrated_
)
{
if
(
calibrated_
)
{
_updateIntrinsics
();
LOG
(
INFO
)
<<
"Calibration loaded from file"
;
LOG
(
INFO
)
<<
"Calibration loaded from file"
;
map1_gpu_
.
first
.
upload
(
map1
.
first
,
stream
);
map1_gpu_
.
second
.
upload
(
map1
.
second
,
stream
);
map2_gpu_
.
first
.
upload
(
map2
.
first
,
stream
);
map2_gpu_
.
second
.
upload
(
map2
.
second
,
stream
);
}
}
else
{
else
{
LOG
(
WARNING
)
<<
"Calibration not loaded"
;
LOG
(
WARNING
)
<<
"Calibration not loaded"
;
}
}
this
->
on
(
"use_intrinsics"
,
[
this
](
const
ftl
::
config
::
Event
&
e
)
{
_updateIntrinsics
();
});
}
void
Calibrate
::
_updateIntrinsics
()
{
Mat
R1
,
R2
,
P1
,
P2
;
std
::
pair
<
Mat
,
Mat
>
map1
,
map2
;
if
(
this
->
value
(
"use_intrinsics"
,
true
))
{
R1
=
R1_
;
R2
=
R2_
;
P1
=
P1_
;
P2
=
P2_
;
}
else
{
R1
=
Mat
::
eye
(
Size
(
3
,
3
),
CV_64FC1
);
R2
=
R1
;
P1
=
M1_
;
P2
=
M2_
;
}
initUndistortRectifyMap
(
M1_
,
D1_
,
R1
,
P1
,
img_size_
,
CV_32FC1
,
map1
.
first
,
map2
.
first
);
initUndistortRectifyMap
(
M2_
,
D2_
,
R2
,
P2
,
img_size_
,
CV_32FC1
,
map1
.
second
,
map2
.
second
);
map1_gpu_
.
first
.
upload
(
map1
.
first
);
map1_gpu_
.
second
.
upload
(
map1
.
second
);
map2_gpu_
.
first
.
upload
(
map2
.
first
);
map2_gpu_
.
second
.
upload
(
map2
.
second
);
}
}
bool
Calibrate
::
_loadCalibration
(
cv
::
Size
img_size
,
std
::
pair
<
Mat
,
Mat
>
&
map1
,
std
::
pair
<
Mat
,
Mat
>
&
map2
)
{
bool
Calibrate
::
_loadCalibration
(
cv
::
Size
img_size
,
std
::
pair
<
Mat
,
Mat
>
&
map1
,
std
::
pair
<
Mat
,
Mat
>
&
map2
)
{
...
...
This diff is collapsed.
Click to expand it.
components/rgbd-sources/src/calibrate.hpp
+
2
−
1
View file @
d186df85
...
@@ -43,7 +43,7 @@ class Calibrate : public ftl::Configurable {
...
@@ -43,7 +43,7 @@ class Calibrate : public ftl::Configurable {
bool
isCalibrated
();
bool
isCalibrated
();
void
updateCalibration
(
const
ftl
::
rgbd
::
Camera
&
p
);
void
updateCalibration
(
const
ftl
::
rgbd
::
Camera
&
p
);
/**
/**
* Get the camera matrix. Used to convert disparity map back to depth and
* Get the camera matrix. Used to convert disparity map back to depth and
* a 3D point cloud.
* a 3D point cloud.
...
@@ -52,6 +52,7 @@ class Calibrate : public ftl::Configurable {
...
@@ -52,6 +52,7 @@ class Calibrate : public ftl::Configurable {
const
cv
::
Mat
&
getCameraMatrix
()
const
{
return
P_
;
}
const
cv
::
Mat
&
getCameraMatrix
()
const
{
return
P_
;
}
private
:
private
:
void
_updateIntrinsics
();
bool
_loadCalibration
(
cv
::
Size
img_size
,
std
::
pair
<
cv
::
Mat
,
cv
::
Mat
>
&
map1
,
std
::
pair
<
cv
::
Mat
,
cv
::
Mat
>
&
map2
);
bool
_loadCalibration
(
cv
::
Size
img_size
,
std
::
pair
<
cv
::
Mat
,
cv
::
Mat
>
&
map1
,
std
::
pair
<
cv
::
Mat
,
cv
::
Mat
>
&
map2
);
private
:
private
:
...
...
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