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
fd5efdba
Commit
fd5efdba
authored
3 years ago
by
Mederic Fourmy
Browse files
Options
Downloads
Patches
Plain Diff
Refactor equalization
parent
0ef0e121
No related branches found
No related tags found
1 merge request
!38
Draft: Resolve "Improve visual odometry"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/vision/processor/processor_visual_odometry.h
+10
-0
10 additions, 0 deletions
include/vision/processor/processor_visual_odometry.h
src/processor/processor_visual_odometry.cpp
+32
-34
32 additions, 34 deletions
src/processor/processor_visual_odometry.cpp
with
42 additions
and
34 deletions
include/vision/processor/processor_visual_odometry.h
+
10
−
0
View file @
fd5efdba
...
...
@@ -290,6 +290,16 @@ class ProcessorVisualOdometry : public ProcessorTracker
private
:
void
retainBest
(
std
::
vector
<
cv
::
KeyPoint
>
&
_keypoints
,
int
n
);
/* Equalize image for better detection and tracking
* available methods:
* 0. none
* 1. average
* 2. opencv: histogram_equalization
* 3. opencv: CLAHE
*/
void
equalize_img
(
cv
::
Mat
&
img_incoming
,
ParamsProcessorVisualOdometry
::
EqualizationParams
equalization
)
;
};
}
//namespace wolf
...
...
This diff is collapsed.
Click to expand it.
src/processor/processor_visual_odometry.cpp
+
32
−
34
View file @
fd5efdba
...
...
@@ -87,40 +87,7 @@ void ProcessorVisualOdometry::preProcess()
cv
::
Mat
img_incoming
=
capture_image_incoming_
->
getImage
();
/* Equalize image for better detection and tracking
* available methods:
* 0. none
* 1. average
* 2. opencv: histogram_equalization
* 3. opencv: CLAHE
*/
switch
(
params_visual_odometry_
->
equalization
.
method
)
{
case
0
:
break
;
case
1
:
{
// average to central brightness
auto
img_avg
=
(
cv
::
mean
(
img_incoming
)).
val
[
0
];
img_incoming
+=
cv
::
Scalar
(
round
(
params_visual_odometry_
->
equalization
.
average
.
median
-
img_avg
)
);
break
;
}
case
2
:
{
cv
::
equalizeHist
(
img_incoming
,
img_incoming
);
break
;
}
case
3
:
{
// Contrast Limited Adaptive Histogram Equalization CLAHE
// -> more continuous lighting and higher contrast images
cv
::
Ptr
<
cv
::
CLAHE
>
clahe
=
cv
::
createCLAHE
(
params_visual_odometry_
->
equalization
.
clahe
.
clip_limit
,
params_visual_odometry_
->
equalization
.
clahe
.
tile_grid_size
);
clahe
->
apply
(
img_incoming
,
img_incoming
);
break
;
}
}
equalize_img
(
img_incoming
,
params_visual_odometry_
->
equalization
);
// Time to PREPreprocess the image if necessary: greyscale if BGR, CLAHE etc...
...
...
@@ -706,6 +673,37 @@ void ProcessorVisualOdometry::retainBest(std::vector<cv::KeyPoint> &_keypoints,
}
}
void
ProcessorVisualOdometry
::
equalize_img
(
cv
::
Mat
&
img_incoming
,
ParamsProcessorVisualOdometry
::
EqualizationParams
equalization
)
{
switch
(
equalization
.
method
)
{
case
0
:
break
;
case
1
:
{
// average to central brightness
auto
img_avg
=
(
cv
::
mean
(
img_incoming
)).
val
[
0
];
img_incoming
+=
cv
::
Scalar
(
round
(
equalization
.
average
.
median
-
img_avg
)
);
break
;
}
case
2
:
{
cv
::
equalizeHist
(
img_incoming
,
img_incoming
);
break
;
}
case
3
:
{
// Contrast Limited Adaptive Histogram Equalization CLAHE
// -> more continuous lighting and higher contrast images
cv
::
Ptr
<
cv
::
CLAHE
>
clahe
=
cv
::
createCLAHE
(
equalization
.
clahe
.
clip_limit
,
equalization
.
clahe
.
tile_grid_size
);
clahe
->
apply
(
img_incoming
,
img_incoming
);
break
;
}
}
}
}
//namespace wolf
// Register in the FactoryProcessor
...
...
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