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
207ba36c
Commit
207ba36c
authored
5 years ago
by
Nicolas Pope
Browse files
Options
Downloads
Patches
Plain Diff
Attempt to focal limit the features
parent
91270c59
No related branches found
No related tags found
1 merge request
!347
Feature buckets experiment
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/libstereo/src/algorithms/clustersf.cu
+3
-3
3 additions, 3 deletions
lib/libstereo/src/algorithms/clustersf.cu
lib/libstereo/src/filters/salient_gradient.hpp
+16
-1
16 additions, 1 deletion
lib/libstereo/src/filters/salient_gradient.hpp
with
19 additions
and
4 deletions
lib/libstereo/src/algorithms/clustersf.cu
+
3
−
3
View file @
207ba36c
...
...
@@ -38,7 +38,7 @@ void StereoCSF::compute(cv::InputArray l, cv::InputArray r, cv::OutputArray disp
mat2gray
(
l
,
impl_
->
l
);
mat2gray
(
r
,
impl_
->
r
);
SalientGradient
sgl
=
{
impl_
->
l
.
data
(),
impl_
->
gl
.
data
(),
impl_
->
temp
.
data
(),
impl_
->
buckets_l
.
data
(),
impl_
->
l
.
width
,
impl_
->
l
.
height
};
SalientGradient
sgl
=
{
make_short2
(
1000
,
800
),
200
,
impl_
->
l
.
data
(),
impl_
->
gl
.
data
(),
impl_
->
temp
.
data
(),
impl_
->
buckets_l
.
data
(),
impl_
->
l
.
width
,
impl_
->
l
.
height
};
parallel1DWarpSM
(
sgl
,
l
.
rows
(),
l
.
cols
());
SalientGradientGrouped
sgr
=
{
impl_
->
r
.
data
(),
impl_
->
gr
.
data
(),
impl_
->
temp
.
data
(),
impl_
->
buckets_r
.
data
(),
impl_
->
r
.
width
,
impl_
->
r
.
height
};
parallel1DWarpSM
(
sgr
,
r
.
rows
(),
r
.
cols
());
...
...
@@ -59,10 +59,10 @@ void StereoCSF::compute(cv::InputArray l, cv::InputArray r, cv::OutputArray disp
std
::
cout
<<
"Focal Disparity = "
<<
maxloc
[
1
]
<<
std
::
endl
;
tmp
.
convertTo
(
tmp
,
CV_8UC1
,
0.
1
);
tmp
.
convertTo
(
tmp
,
CV_8UC1
,
1
0
);
cv
::
resize
(
tmp
,
tmp
,
cv
::
Size
(
tmp
.
cols
,
100
));
cv
::
applyColorMap
(
tmp
,
tmp
,
cv
::
COLORMAP_TURBO
);
cv
::
imshow
(
"
Gradients Righ
t"
,
tmp
);
cv
::
imshow
(
"
Disparity His
t"
,
tmp
);
cv
::
Mat
imgleft
,
imgright
;
impl_
->
l
.
toGpuMat
().
download
(
imgleft
);
...
...
This diff is collapsed.
Click to expand it.
lib/libstereo/src/filters/salient_gradient.hpp
+
16
−
1
View file @
207ba36c
...
...
@@ -9,8 +9,15 @@
/**
* Select salient gradient features and gather into scanline buckets that
* includes the x-coordinate and feature orientation. Not grouped by orientation.
*
* TODO: This needs to be a focal point modified version. Radius from focal
* point determines threshold, but the radius itself is determined by feature
* density around the focal point ... ultimately keeping the number of features
* within a reasonable very small level per scanline (say 2-8).
*/
struct
SalientGradient
{
short2
focal_pt
;
int
radius
;
Array2D
<
uchar
>::
Data
image
;
Array2D
<
uchar
>::
Data
angle
;
Array2D
<
uchar
>::
Data
magnitude
;
...
...
@@ -47,6 +54,13 @@ struct SalientGradient {
return
__ffs
(
t
);
}
__device__
inline
float
weighting
(
float
r
,
float
h
)
{
if
(
r
>=
h
)
return
0.0
f
;
float
rh
=
r
/
h
;
rh
=
1.0
f
-
rh
*
rh
;
return
rh
*
rh
*
rh
*
rh
;
}
__device__
void
operator
()(
ushort2
thread
,
ushort2
stride
,
ushort2
size
,
WarpSharedMemory
&
wsm
)
{
static
const
float
PI
=
3.14
f
;
static
constexpr
float
PI2
=
PI
/
2.0
f
;
...
...
@@ -73,7 +87,8 @@ struct SalientGradient {
// Apply threshold
for
(
int
x
=
thread
.
x
;
x
<
size
.
x
;
x
+=
stride
.
x
)
{
uchar
thresh
=
gthresh
;
uchar
focal_thresh
=
max
(
255
,
int
((
1.0
f
-
weighting
(
float
(
abs
(
focal_pt
.
x
-
x
)),
float
(
radius
)))
*
255.0
f
));
uchar
thresh
=
max
(
gthresh
,
focal_thresh
);
for
(
int
u
=-
3
;
u
<=
3
;
++
u
)
{
thresh
=
(
x
+
u
>=
0
&&
x
+
u
<
width
)
?
max
(
thresh
,
magnitude
(
y
,
x
+
u
))
:
thresh
;
}
...
...
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