Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
vision_utils
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
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
labrobotica
algorithms
vision_utils
Commits
c264bd6b
Commit
c264bd6b
authored
7 years ago
by
Angel Santamaria-Navarro
Browse files
Options
Downloads
Patches
Plain Diff
Add ROIEnhanced and update buildImageProcessed function
parent
dbb36759
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/vision_utils.cpp
+14
-1
14 additions, 1 deletion
src/vision_utils.cpp
src/vision_utils.h
+24
-1
24 additions, 1 deletion
src/vision_utils.h
with
38 additions
and
2 deletions
src/vision_utils.cpp
+
14
−
1
View file @
c264bd6b
...
...
@@ -368,7 +368,7 @@ Eigen::Matrix3s normalizePointsIsotrop(const Eigen::MatrixXs& l_in, Eigen::Matri
return
T
;
}
cv
::
Mat
buildImageProcessed
(
const
cv
::
Mat
&
_img
,
const
std
::
vector
<
KeyPointEnhanced
>&
_kps_e
)
cv
::
Mat
buildImageProcessed
(
const
cv
::
Mat
&
_img
,
const
std
::
vector
<
KeyPointEnhanced
>&
_kps_e
,
const
std
::
vector
<
ROIEnhanced
>&
_rois_e
)
{
// Check if image is RGB, if not convert it
cv
::
Mat
img
;
...
...
@@ -377,6 +377,19 @@ cv::Mat buildImageProcessed(const cv::Mat& _img, const std::vector<KeyPointEnhan
else
img
=
_img
.
clone
();
// Draw ROIs
for
(
auto
roi_e
:
_rois_e
)
{
if
(
roi_e
.
alpha
>
0.0
)
{
assert
(
roi_e
.
thick
!=-
1
);
cv
::
Mat
color
(
roi_e
.
roi
.
size
(),
CV_8UC3
,
roi_e
.
color
);
cv
::
Mat
roi
=
img
(
roi_e
.
roi
);
cv
::
addWeighted
(
color
,
roi_e
.
alpha
,
roi
,
1.0
-
roi_e
.
alpha
,
0.0
,
roi
);
}
cv
::
rectangle
(
img
,
roi_e
.
roi
,
roi_e
.
color
,
roi_e
.
thick
,
8
,
0
);
}
// Draw KeyPoints
for
(
auto
kp_e
:
_kps_e
)
{
...
...
This diff is collapsed.
Click to expand it.
src/vision_utils.h
+
24
−
1
View file @
c264bd6b
...
...
@@ -499,7 +499,30 @@ struct KeyPointEnhanced
bool
is_inlier
;
};
cv
::
Mat
buildImageProcessed
(
const
cv
::
Mat
&
_img
,
const
std
::
vector
<
KeyPointEnhanced
>&
_kps_e
);
struct
ROIEnhanced
{
ROIEnhanced
(
const
cv
::
Rect
&
_roi
,
const
bool
&
_is_inlier
)
:
roi
(
_roi
),
is_inlier
(
_is_inlier
)
{
// Default values
thick
=
1
;
alpha
=
0.1
;
if
(
is_inlier
)
color
=
cv
::
Scalar
(
0
,
255
,
0
);
// green
else
color
=
cv
::
Scalar
(
255
,
0
,
0
);
// blue
}
cv
::
Rect
roi
;
bool
is_inlier
;
int
thick
;
Scalar
alpha
;
cv
::
Scalar
color
;
};
cv
::
Mat
buildImageProcessed
(
const
cv
::
Mat
&
_img
,
const
std
::
vector
<
KeyPointEnhanced
>&
_kps_e
,
const
std
::
vector
<
ROIEnhanced
>&
_rois_e
);
// end of draw functions //////////////////////////////////////////////////
...
...
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