Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
vision
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
mobile_robotics
wolf_projects
wolf_lib
plugins
vision
Commits
3a61ab9e
Commit
3a61ab9e
authored
3 years ago
by
Joan Solà Ortega
Browse files
Options
Downloads
Patches
Plain Diff
Improve API of SensorCamera
parent
4aa3bc48
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!36
After cmake and const refactor
,
!28
Resolve "Building a new visual odometry system"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/vision/sensor/sensor_camera.h
+11
-10
11 additions, 10 deletions
include/vision/sensor/sensor_camera.h
src/sensor/sensor_camera.cpp
+9
-1
9 additions, 1 deletion
src/sensor/sensor_camera.cpp
with
20 additions
and
11 deletions
include/vision/sensor/sensor_camera.h
+
11
−
10
View file @
3a61ab9e
...
@@ -137,17 +137,18 @@ class SensorCamera : public SensorBase
...
@@ -137,17 +137,18 @@ class SensorCamera : public SensorBase
~
SensorCamera
()
override
;
~
SensorCamera
()
override
;
Eigen
::
VectorXd
getDistortionVector
()
{
return
distortion_
;
}
Eigen
::
VectorXd
getDistortionVector
()
const
{
return
distortion_
;
}
Eigen
::
VectorXd
getCorrectionVector
()
{
return
correction_
;
}
Eigen
::
VectorXd
getCorrectionVector
()
const
{
return
correction_
;
}
Eigen
::
Matrix3d
getIntrinsicMatrix
()
{
return
K_
;
}
Eigen
::
Matrix3d
getIntrinsicMatrix
()
const
{
return
K_
;
}
Eigen
::
Vector4d
getPinholeModel
()
{
if
(
using_raw_
)
return
pinhole_model_raw_
;
else
return
pinhole_model_rectified_
;}
Eigen
::
Vector4d
getPinholeModel
()
const
{
if
(
using_raw_
)
return
pinhole_model_raw_
;
else
return
pinhole_model_rectified_
;}
Eigen
::
Matrix
<
double
,
3
,
4
>
getProjectionMatrix
()
const
;
bool
isUsingRawImages
()
{
return
using_raw_
;
}
bool
isUsingRawImages
()
const
{
return
using_raw_
;
}
bool
useRawImages
();
bool
useRawImages
();
bool
useRectifiedImages
();
bool
useRectifiedImages
();
int
getImgWidth
()
{
return
img_width_
;}
int
getImgWidth
()
const
{
return
img_width_
;}
int
getImgHeight
()
{
return
img_height_
;}
int
getImgHeight
()
const
{
return
img_height_
;}
void
setImgWidth
(
int
_w
)
{
img_width_
=
_w
;}
void
setImgWidth
(
int
_w
)
{
img_width_
=
_w
;}
void
setImgHeight
(
int
_h
)
{
img_height_
=
_h
;}
void
setImgHeight
(
int
_h
)
{
img_height_
=
_h
;}
...
@@ -160,7 +161,7 @@ class SensorCamera : public SensorBase
...
@@ -160,7 +161,7 @@ class SensorCamera : public SensorBase
Eigen
::
Matrix3d
K_
;
Eigen
::
Matrix3d
K_
;
bool
using_raw_
;
bool
using_raw_
;
virtual
Eigen
::
Matrix3d
set
IntrinsicMatrix
(
Eigen
::
Vector4d
_pinhole_model
);
Eigen
::
Matrix3d
compute
IntrinsicMatrix
(
const
Eigen
::
Vector4d
&
_pinhole_model
)
const
;
public
:
public
:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
;
// to guarantee alignment (see http://eigen.tuxfamily.org/dox-devel/group__TopicStructHavingEigenMembers.html)
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
;
// to guarantee alignment (see http://eigen.tuxfamily.org/dox-devel/group__TopicStructHavingEigenMembers.html)
...
@@ -169,7 +170,7 @@ class SensorCamera : public SensorBase
...
@@ -169,7 +170,7 @@ class SensorCamera : public SensorBase
inline
bool
SensorCamera
::
useRawImages
()
inline
bool
SensorCamera
::
useRawImages
()
{
{
getIntrinsic
()
->
setState
(
pinhole_model_raw_
);
getIntrinsic
()
->
setState
(
pinhole_model_raw_
);
K_
=
set
IntrinsicMatrix
(
pinhole_model_raw_
);
K_
=
compute
IntrinsicMatrix
(
pinhole_model_raw_
);
using_raw_
=
true
;
using_raw_
=
true
;
return
true
;
return
true
;
...
@@ -178,7 +179,7 @@ inline bool SensorCamera::useRawImages()
...
@@ -178,7 +179,7 @@ inline bool SensorCamera::useRawImages()
inline
bool
SensorCamera
::
useRectifiedImages
()
inline
bool
SensorCamera
::
useRectifiedImages
()
{
{
getIntrinsic
()
->
setState
(
pinhole_model_rectified_
);
getIntrinsic
()
->
setState
(
pinhole_model_rectified_
);
K_
=
set
IntrinsicMatrix
(
pinhole_model_rectified_
);
K_
=
compute
IntrinsicMatrix
(
pinhole_model_rectified_
);
distortion_
.
resize
(
0
);
// remove distortion from model
distortion_
.
resize
(
0
);
// remove distortion from model
correction_
.
resize
(
0
);
correction_
.
resize
(
0
);
using_raw_
=
false
;
using_raw_
=
false
;
...
...
This diff is collapsed.
Click to expand it.
src/sensor/sensor_camera.cpp
+
9
−
1
View file @
3a61ab9e
...
@@ -62,7 +62,15 @@ SensorCamera::~SensorCamera()
...
@@ -62,7 +62,15 @@ SensorCamera::~SensorCamera()
//
//
}
}
Eigen
::
Matrix3d
SensorCamera
::
setIntrinsicMatrix
(
Eigen
::
Vector4d
_pinhole_model
)
Eigen
::
Matrix
<
double
,
3
,
4
>
SensorCamera
::
getProjectionMatrix
()
const
{
Eigen
::
Matrix
<
double
,
3
,
4
>
P
;
P
.
setZero
();
P
.
leftCols
(
3
)
=
getIntrinsicMatrix
();
return
P
;
}
Eigen
::
Matrix3d
SensorCamera
::
computeIntrinsicMatrix
(
const
Eigen
::
Vector4d
&
_pinhole_model
)
const
{
{
Eigen
::
Matrix3d
K
;
Eigen
::
Matrix3d
K
;
K
(
0
,
0
)
=
_pinhole_model
(
2
);
K
(
0
,
0
)
=
_pinhole_model
(
2
);
...
...
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