Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
wolf_ros_vision
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
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
mobile_robotics
wolf_projects
wolf_ros
wolf_ros_vision
Commits
70b867f0
Commit
70b867f0
authored
3 years ago
by
Mederic Fourmy
Browse files
Options
Downloads
Patches
Plain Diff
[slip-ci] adapt to constness changes
parent
07dc050d
No related branches found
No related tags found
2 merge requests
!3
After cmake and const refactor
,
!1
Resolve "Publisher for visual odometry"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/publisher_vision.h
+13
-13
13 additions, 13 deletions
include/publisher_vision.h
src/publisher_vision.cpp
+20
-20
20 additions, 20 deletions
src/publisher_vision.cpp
with
33 additions
and
33 deletions
include/publisher_vision.h
+
13
−
13
View file @
70b867f0
...
@@ -58,7 +58,7 @@ class PublisherVisionDebug : public Publisher
...
@@ -58,7 +58,7 @@ class PublisherVisionDebug : public Publisher
public:
public:
PublisherVisionDebug
(
const
std
::
string
&
_unique_name
,
PublisherVisionDebug
(
const
std
::
string
&
_unique_name
,
const
ParamsServer
&
_server
,
const
ParamsServer
&
_server
,
const
ProblemPtr
_problem
);
const
Problem
Const
Ptr
_problem
);
WOLF_PUBLISHER_CREATE
(
PublisherVisionDebug
);
WOLF_PUBLISHER_CREATE
(
PublisherVisionDebug
);
virtual
~
PublisherVisionDebug
(){};
virtual
~
PublisherVisionDebug
(){};
...
@@ -69,9 +69,9 @@ class PublisherVisionDebug : public Publisher
...
@@ -69,9 +69,9 @@ class PublisherVisionDebug : public Publisher
void
publishDerived
()
override
;
void
publishDerived
()
override
;
protected
:
protected
:
ProcessorVisualOdometryPtr
processor_vision_
;
ProcessorVisualOdometry
Const
Ptr
processor_vision_
;
CaptureBasePtr
last_capture_
;
CaptureBase
Const
Ptr
last_capture_
;
std
::
string
topic_preprocessor_
;
std
::
string
topic_preprocessor_
;
struct
Feature
{
struct
Feature
{
double
thickness_
;
double
thickness_
;
...
@@ -126,7 +126,7 @@ class PublisherVisionDebug : public Publisher
...
@@ -126,7 +126,7 @@ class PublisherVisionDebug : public Publisher
/*
/*
Search for the maximum and minimum of features in one track in the track matrix
Search for the maximum and minimum of features in one track in the track matrix
*/
*/
std
::
pair
<
int
,
int
>
minMaxAliveTrackLength
(
const
TrackMatrix
&
_track_matrix
,
CaptureBasePtr
_cap_img
)
const
;
std
::
pair
<
int
,
int
>
minMaxAliveTrackLength
(
const
TrackMatrix
&
_track_matrix
,
CaptureBase
Const
Ptr
_cap_img
)
const
;
/*
/*
Return a unique RGB color vector depending on the lenght of the track given,
Return a unique RGB color vector depending on the lenght of the track given,
...
@@ -142,32 +142,32 @@ class PublisherVisionDebug : public Publisher
...
@@ -142,32 +142,32 @@ class PublisherVisionDebug : public Publisher
/*
/*
Change an image to show tracks and features within it
Change an image to show tracks and features within it
*/
*/
void
showTracks
(
cv
::
Mat
_image
,
const
TrackMatrix
&
_track_matrix
,
CaptureBasePtr
_cap_img
);
void
showTracks
(
cv
::
Mat
_image
,
const
TrackMatrix
&
_track_matrix
,
CaptureBase
Const
Ptr
_cap_img
);
/*
/*
Return the transformation from world to camera
Return the transformation from world to camera
*/
*/
Eigen
::
Isometry3d
getTcw
(
const
CaptureBasePtr
_capture
)
const
;
Eigen
::
Isometry3d
getTcw
(
const
CaptureBase
Const
Ptr
_capture
)
const
;
/*
/*
Transform Tcw into matrix for multiplication purpose
Transform Tcw into matrix for multiplication purpose
*/
*/
Eigen
::
Matrix4d
getTcwMatrix
(
const
CaptureBasePtr
_capture
)
const
;
Eigen
::
Matrix4d
getTcwMatrix
(
const
CaptureBase
Const
Ptr
_capture
)
const
;
/*
/*
Return the projection matrix of a sensor (linked to a capture)
Return the projection matrix of a sensor (linked to a capture)
*/
*/
Eigen
::
Matrix
<
double
,
3
,
4
>
getProjectionMatrix
(
const
CaptureBasePtr
_capture
)
const
;
Eigen
::
Matrix
<
double
,
3
,
4
>
getProjectionMatrix
(
const
CaptureBase
Const
Ptr
_capture
)
const
;
/*
/*
Return only the landmark associated to a feature in last keyframes
Return only the landmark associated to a feature in last keyframes
*/
*/
LandmarkBase
Ptr
getAssociatedLandmark
(
const
TrackMatrix
&
_track_matrix
,
const
FeatureBasePtr
&
_ftr
);
LandmarkBase
ConstPtr
getAssociatedLandmark
(
const
TrackMatrix
&
_track_matrix
,
const
FeatureBase
Const
Ptr
&
_ftr
);
/*
/*
Return the projection of a landmark in the frame
Return the projection of a landmark in the frame
*/
*/
Eigen
::
Vector2d
projectLandmarkHp
(
const
Eigen
::
Matrix
<
double
,
3
,
4
>&
_trf_proj_mat
,
const
LandmarkBasePtr
_lmk
);
Eigen
::
Vector2d
projectLandmarkHp
(
const
Eigen
::
Matrix
<
double
,
3
,
4
>&
_trf_proj_mat
,
const
LandmarkBase
Const
Ptr
_lmk
);
/*
/*
Print one landmark into the capture
Print one landmark into the capture
...
@@ -177,12 +177,12 @@ class PublisherVisionDebug : public Publisher
...
@@ -177,12 +177,12 @@ class PublisherVisionDebug : public Publisher
/*
/*
Print all of the landmarks associated with the capture
Print all of the landmarks associated with the capture
*/
*/
void
showLandmarks
(
cv
::
Mat
_image
,
const
TrackMatrix
&
_track_matrix
,
const
CaptureBasePtr
&
_cap
);
void
showLandmarks
(
cv
::
Mat
_image
,
const
TrackMatrix
&
_track_matrix
,
const
CaptureBase
Const
Ptr
&
_cap
);
/*
/*
Change an image to show tracks and features from the preprocess within it
Change an image to show tracks and features from the preprocess within it
*/
*/
void
showTracksPreprocess
(
cv
::
Mat
_image
,
const
CaptureImagePtr
&
_origin
,
const
CaptureImagePtr
&
_last
);
void
showTracksPreprocess
(
cv
::
Mat
_image
,
const
CaptureImage
Const
Ptr
&
_origin
,
const
CaptureImage
Const
Ptr
&
_last
);
};
};
WOLF_REGISTER_PUBLISHER
(
PublisherVisionDebug
)
WOLF_REGISTER_PUBLISHER
(
PublisherVisionDebug
)
...
...
This diff is collapsed.
Click to expand it.
src/publisher_vision.cpp
+
20
−
20
View file @
70b867f0
...
@@ -63,7 +63,7 @@ Color PublisherVisionDebug::colorStringToEnum(const std::string _color)
...
@@ -63,7 +63,7 @@ Color PublisherVisionDebug::colorStringToEnum(const std::string _color)
PublisherVisionDebug
::
PublisherVisionDebug
(
const
std
::
string
&
_unique_name
,
PublisherVisionDebug
::
PublisherVisionDebug
(
const
std
::
string
&
_unique_name
,
const
ParamsServer
&
_server
,
const
ParamsServer
&
_server
,
const
ProblemPtr
_problem
)
:
const
Problem
Const
Ptr
_problem
)
:
Publisher
(
_unique_name
,
_server
,
_problem
),
Publisher
(
_unique_name
,
_server
,
_problem
),
processor_vision_
(
nullptr
),
processor_vision_
(
nullptr
),
last_capture_
(
nullptr
),
last_capture_
(
nullptr
),
...
@@ -113,11 +113,11 @@ PublisherVisionDebug::PublisherVisionDebug(const std::string &_unique_name,
...
@@ -113,11 +113,11 @@ PublisherVisionDebug::PublisherVisionDebug(const std::string &_unique_name,
throw
std
::
runtime_error
(
throw
std
::
runtime_error
(
"PublisherVisionDebug: name of processor of type ProcessorVisualOdometry not provided"
);
"PublisherVisionDebug: name of processor of type ProcessorVisualOdometry not provided"
);
auto
proc
=
problem_
->
findProcessor
(
processor_name
);
ProcessorBaseConstPtr
proc
=
problem_
->
findProcessor
(
processor_name
);
if
(
not
proc
)
if
(
not
proc
)
throw
std
::
runtime_error
(
throw
std
::
runtime_error
(
"PublisherVisionDebug: processor "
+
processor_name
+
" not found."
);
"PublisherVisionDebug: processor "
+
processor_name
+
" not found."
);
processor_vision_
=
std
::
dynamic_pointer_cast
<
ProcessorVisualOdometry
>
(
proc
);
processor_vision_
=
std
::
dynamic_pointer_cast
<
const
ProcessorVisualOdometry
>
(
proc
);
if
(
not
processor_vision_
)
if
(
not
processor_vision_
)
throw
std
::
runtime_error
(
throw
std
::
runtime_error
(
"PublisherVisionDebug: processor "
+
processor_name
+
" is not of type ProcessorVisualOdometry"
);
"PublisherVisionDebug: processor "
+
processor_name
+
" is not of type ProcessorVisualOdometry"
);
...
@@ -146,8 +146,8 @@ void PublisherVisionDebug::publishDerived()
...
@@ -146,8 +146,8 @@ void PublisherVisionDebug::publishDerived()
return
;
return
;
// Get capture image
// Get capture image
auto
cap_img
=
std
::
dynamic_pointer_cast
<
CaptureImage
>
(
processor_vision_
->
getLast
());
auto
cap_img
=
std
::
dynamic_pointer_cast
<
const
CaptureImage
>
(
processor_vision_
->
getLast
());
auto
cap_img_origin
=
std
::
dynamic_pointer_cast
<
CaptureImage
>
(
processor_vision_
->
getOrigin
());
auto
cap_img_origin
=
std
::
dynamic_pointer_cast
<
const
CaptureImage
>
(
processor_vision_
->
getOrigin
());
assert
(
cap_img
!=
nullptr
&&
"Received Capture is not of type CaptureImage!"
);
assert
(
cap_img
!=
nullptr
&&
"Received Capture is not of type CaptureImage!"
);
assert
(
cap_img_origin
!=
nullptr
&&
"Received origin Capture is not of type CaptureImage!"
);
assert
(
cap_img_origin
!=
nullptr
&&
"Received origin Capture is not of type CaptureImage!"
);
...
@@ -211,17 +211,17 @@ void PublisherVisionDebug::publishDerived()
...
@@ -211,17 +211,17 @@ void PublisherVisionDebug::publishDerived()
}
}
}
}
std
::
pair
<
int
,
int
>
PublisherVisionDebug
::
minMaxAliveTrackLength
(
const
TrackMatrix
&
_track_matrix
,
CaptureBasePtr
_cap_img
)
const
std
::
pair
<
int
,
int
>
PublisherVisionDebug
::
minMaxAliveTrackLength
(
const
TrackMatrix
&
_track_matrix
,
CaptureBase
Const
Ptr
_cap_img
)
const
{
{
map
<
size_t
,
FeatureBasePtr
>
alive_features
=
_track_matrix
.
snapshot
(
_cap_img
);
SnapshotConst
alive_features
=
_track_matrix
.
snapshot
(
_cap_img
);
int
max
=
-
1
;
int
max
=
-
1
;
int
min
=
10
;
int
min
=
10
;
for
(
auto
alive_feat
:
alive_features
)
for
(
auto
alive_feat
:
alive_features
)
{
{
Track
track_alive
=
_track_matrix
.
track
(
alive_feat
.
second
->
trackId
());
Track
Const
track_alive
=
_track_matrix
.
track
(
alive_feat
.
second
->
trackId
());
int
count
=
track_alive
.
size
();
int
count
=
track_alive
.
size
();
...
@@ -357,7 +357,7 @@ cv::Scalar PublisherVisionDebug::primaryColor(Color _color)
...
@@ -357,7 +357,7 @@ cv::Scalar PublisherVisionDebug::primaryColor(Color _color)
void
PublisherVisionDebug
::
showTracks
(
cv
::
Mat
_image
,
void
PublisherVisionDebug
::
showTracks
(
cv
::
Mat
_image
,
const
TrackMatrix
&
_track_matrix
,
const
TrackMatrix
&
_track_matrix
,
CaptureBasePtr
_capture_img
)
CaptureBase
Const
Ptr
_capture_img
)
{
{
std
::
pair
<
int
,
int
>
min_max_track_length
;
std
::
pair
<
int
,
int
>
min_max_track_length
;
...
@@ -446,7 +446,7 @@ void PublisherVisionDebug::showTracks(cv::Mat _image,
...
@@ -446,7 +446,7 @@ void PublisherVisionDebug::showTracks(cv::Mat _image,
for
(
auto
ftr_alive
:
_track_matrix
.
snapshot
(
_capture_img
))
for
(
auto
ftr_alive
:
_track_matrix
.
snapshot
(
_capture_img
))
{
{
// get full track of feature
// get full track of feature
Track
track
=
_track_matrix
.
track
(
ftr_alive
.
second
->
trackId
());
Track
Const
track
=
_track_matrix
.
track
(
ftr_alive
.
second
->
trackId
());
if
(
track
.
size
()
==
0
)
if
(
track
.
size
()
==
0
)
{
{
WOLF_WARN
(
"SIZE 0 TRACK!!"
);
WOLF_WARN
(
"SIZE 0 TRACK!!"
);
...
@@ -485,7 +485,7 @@ void PublisherVisionDebug::showTracks(cv::Mat _image,
...
@@ -485,7 +485,7 @@ void PublisherVisionDebug::showTracks(cv::Mat _image,
// iterate track from current time to the beginning of track
// iterate track from current time to the beginning of track
for
(
Track
::
reverse_iterator
ftr
=
track
.
rbegin
();
ftr
!=
track
.
rend
();
++
ftr
)
// start at the feature of the capture to draw
for
(
Track
Const
::
reverse_iterator
ftr
=
track
.
rbegin
();
ftr
!=
track
.
rend
();
++
ftr
)
// start at the feature of the capture to draw
{
{
auto
previous
=
std
::
prev
(
ftr
);
//previous iterator
auto
previous
=
std
::
prev
(
ftr
);
//previous iterator
...
@@ -516,7 +516,7 @@ void PublisherVisionDebug::showTracks(cv::Mat _image,
...
@@ -516,7 +516,7 @@ void PublisherVisionDebug::showTracks(cv::Mat _image,
}
}
}
}
Eigen
::
Isometry3d
PublisherVisionDebug
::
getTcw
(
const
CaptureBasePtr
_capture
)
const
Eigen
::
Isometry3d
PublisherVisionDebug
::
getTcw
(
const
CaptureBase
Const
Ptr
_capture
)
const
{
{
// get robot position and orientation at capture's timestamp
// get robot position and orientation at capture's timestamp
const
auto
&
state
=
problem_
->
getState
(
_capture
->
getTimeStamp
(),
"PO"
);
const
auto
&
state
=
problem_
->
getState
(
_capture
->
getTimeStamp
(),
"PO"
);
...
@@ -532,17 +532,17 @@ Eigen::Isometry3d PublisherVisionDebug::getTcw(const CaptureBasePtr _capture) co
...
@@ -532,17 +532,17 @@ Eigen::Isometry3d PublisherVisionDebug::getTcw(const CaptureBasePtr _capture) co
return
(
T_w_r
*
T_r_c
).
inverse
();
return
(
T_w_r
*
T_r_c
).
inverse
();
}
}
Eigen
::
Matrix4d
PublisherVisionDebug
::
getTcwMatrix
(
const
CaptureBasePtr
_capture
)
const
Eigen
::
Matrix4d
PublisherVisionDebug
::
getTcwMatrix
(
const
CaptureBase
Const
Ptr
_capture
)
const
{
{
return
getTcw
(
_capture
).
matrix
();
return
getTcw
(
_capture
).
matrix
();
}
}
Eigen
::
Matrix
<
double
,
3
,
4
>
PublisherVisionDebug
::
getProjectionMatrix
(
const
CaptureBasePtr
_capture
)
const
Eigen
::
Matrix
<
double
,
3
,
4
>
PublisherVisionDebug
::
getProjectionMatrix
(
const
CaptureBase
Const
Ptr
_capture
)
const
{
{
return
(
std
::
static_pointer_cast
<
SensorCamera
>
(
_capture
->
getSensor
()))
->
getProjectionMatrix
();
return
(
std
::
static_pointer_cast
<
const
SensorCamera
>
(
_capture
->
getSensor
()))
->
getProjectionMatrix
();
}
}
LandmarkBasePtr
PublisherVisionDebug
::
getAssociatedLandmark
(
const
TrackMatrix
&
_track_matrix
,
const
FeatureBasePtr
&
_ftr
)
LandmarkBase
Const
Ptr
PublisherVisionDebug
::
getAssociatedLandmark
(
const
TrackMatrix
&
_track_matrix
,
const
FeatureBase
Const
Ptr
&
_ftr
)
{
{
const
auto
&
track_at_kfs
=
_track_matrix
.
trackAtKeyframes
(
_ftr
->
trackId
());
const
auto
&
track_at_kfs
=
_track_matrix
.
trackAtKeyframes
(
_ftr
->
trackId
());
...
@@ -560,7 +560,7 @@ LandmarkBasePtr PublisherVisionDebug::getAssociatedLandmark(const TrackMatrix& _
...
@@ -560,7 +560,7 @@ LandmarkBasePtr PublisherVisionDebug::getAssociatedLandmark(const TrackMatrix& _
return
lmk
;
return
lmk
;
}
}
Eigen
::
Vector2d
PublisherVisionDebug
::
projectLandmarkHp
(
const
Eigen
::
Matrix
<
double
,
3
,
4
>&
_trf_proj_mat
,
const
LandmarkBasePtr
_lmk
)
Eigen
::
Vector2d
PublisherVisionDebug
::
projectLandmarkHp
(
const
Eigen
::
Matrix
<
double
,
3
,
4
>&
_trf_proj_mat
,
const
LandmarkBase
Const
Ptr
_lmk
)
{
{
const
auto
&
pos
=
_lmk
->
getP
()
->
getState
();
const
auto
&
pos
=
_lmk
->
getP
()
->
getState
();
Eigen
::
Vector3d
pixel_hmg
=
_trf_proj_mat
*
pos
;
Eigen
::
Vector3d
pixel_hmg
=
_trf_proj_mat
*
pos
;
...
@@ -575,7 +575,7 @@ Eigen::Vector2d PublisherVisionDebug::projectLandmarkHp(const Eigen::Matrix<doub
...
@@ -575,7 +575,7 @@ Eigen::Vector2d PublisherVisionDebug::projectLandmarkHp(const Eigen::Matrix<doub
void
PublisherVisionDebug
::
showLandmarks
(
cv
::
Mat
_image
,
void
PublisherVisionDebug
::
showLandmarks
(
cv
::
Mat
_image
,
const
TrackMatrix
&
_track_matrix
,
const
TrackMatrix
&
_track_matrix
,
const
CaptureBasePtr
&
_capture
)
const
CaptureBase
Const
Ptr
&
_capture
)
{
{
// get stuff common to all landmarks
// get stuff common to all landmarks
cv
::
Scalar
color_lmks
=
primaryColor
(
landmarks_
.
color_
);
cv
::
Scalar
color_lmks
=
primaryColor
(
landmarks_
.
color_
);
...
@@ -626,8 +626,8 @@ void PublisherVisionDebug::showLandmarks(cv::Mat _image,
...
@@ -626,8 +626,8 @@ void PublisherVisionDebug::showLandmarks(cv::Mat _image,
}
}
void
PublisherVisionDebug
::
showTracksPreprocess
(
cv
::
Mat
_image
,
void
PublisherVisionDebug
::
showTracksPreprocess
(
cv
::
Mat
_image
,
const
CaptureImagePtr
&
_origin
,
const
CaptureImage
Const
Ptr
&
_origin
,
const
CaptureImagePtr
&
_last
)
const
CaptureImage
Const
Ptr
&
_last
)
{
{
cv
::
Scalar
color_track_preprocess
=
primaryColor
(
tracks_preprocess_
.
color_
);
cv
::
Scalar
color_track_preprocess
=
primaryColor
(
tracks_preprocess_
.
color_
);
...
...
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