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
4376f7d4
Commit
4376f7d4
authored
6 years ago
by
Nicolas Pope
Browse files
Options
Downloads
Patches
Plain Diff
Minor changes and comments
parent
51cc1118
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cv-node/src/algorithms/rtcensus.cu
+17
-14
17 additions, 14 deletions
cv-node/src/algorithms/rtcensus.cu
cv-node/src/middlebury.cpp
+1
-1
1 addition, 1 deletion
cv-node/src/middlebury.cpp
with
18 additions
and
15 deletions
cv-node/src/algorithms/rtcensus.cu
+
17
−
14
View file @
4376f7d4
...
...
@@ -84,20 +84,23 @@ __global__ void census_kernel(cudaTextureObject_t l, cudaTextureObject_t r,
}
}
__forceinline__
__device__
unsigned
long
long
int
int2_as_longlong
(
uint2
a
)
{
unsigned
long
long
in
t
res
;
asm
(
"mov.b64 %0, {%1,%2};"
:
"=l"
(
res
)
:
"r"
(
a
.
x
),
"r"
(
a
.
y
));
return
res
;
/* Convert vector uint2 (32bit x2) into a single uint64_t */
__forceinline__
__device__
uint64_t
uint2asull
(
uint2
a
)
{
uint64_
t
res
;
asm
(
"mov.b64 %0, {%1,%2};"
:
"=l"
(
res
)
:
"r"
(
a
.
x
),
"r"
(
a
.
y
));
return
res
;
}
/*
* Generate left and right disparity images from census data. (19)
*/
__global__
void
disp_kernel
(
float
*
disp_l
,
float
*
disp_r
,
size_t
width
,
size_t
height
,
cudaTextureObject_t
censusL
,
cudaTextureObject_t
censusR
,
size_t
ds
)
{
__global__
void
disp_kernel
(
float
*
disp_l
,
float
*
disp_r
,
size_t
width
,
size_t
height
,
cudaTextureObject_t
censusL
,
cudaTextureObject_t
censusR
,
size_t
ds
)
{
//extern __shared__ uint64_t cache[];
const
int
gamma
=
5
;
const
int
gamma
=
10
;
size_t
u
=
(
blockIdx
.
x
*
BLOCK_W
)
+
threadIdx
.
x
+
RADIUS2
;
size_t
v_start
=
(
blockIdx
.
y
*
ROWSperTHREAD
)
+
RADIUS2
;
...
...
@@ -147,11 +150,11 @@ __global__ void disp_kernel(float *disp_l, float *disp_r, size_t width, size_t h
auto
l2
=
int2
_
as
_longlong
(
tex2D
<
uint2
>
(
censusL
,
u_
,
v_
));
auto
l1
=
int2
_
as
_longlong
(
tex2D
<
uint2
>
(
censusR
,
u_
,
v_
));
auto
l2
=
u
int2as
ull
(
tex2D
<
uint2
>
(
censusL
,
u_
,
v_
));
auto
l1
=
u
int2as
ull
(
tex2D
<
uint2
>
(
censusR
,
u_
,
v_
));
auto
r1
=
int2
_
as
_longlong
(
tex2D
<
uint2
>
(
censusL
,
u_
+
d
,
v_
));
auto
r2
=
int2
_
as
_longlong
(
tex2D
<
uint2
>
(
censusR
,
u_
-
d
,
v_
));
auto
r1
=
u
int2as
ull
(
tex2D
<
uint2
>
(
censusL
,
u_
+
d
,
v_
));
auto
r2
=
u
int2as
ull
(
tex2D
<
uint2
>
(
censusR
,
u_
-
d
,
v_
));
hamming1
+=
__popcll
(
r1
^
l1
);
hamming2
+=
__popcll
(
r2
^
l2
);
...
...
@@ -190,8 +193,8 @@ __global__ void disp_kernel(float *disp_l, float *disp_r, size_t width, size_t h
// Confidence filter (25)
// TODO choice of gamma to depend on disparity variance
// Variance with next option, variance with neighbours, variance with past value
disp_l
[
v
*
width
+
u
]
=
((
min_disp2b
-
min_disp2
)
>=
gamma
)
?
d2
:
INFINITY
;
disp_r
[
v
*
width
+
u
]
=
((
min_disp1b
-
min_disp1
)
>=
gamma
)
?
d1
:
INFINITY
;
disp_l
[
v
*
width
+
u
]
=
((
min_disp2b
-
min_disp2
)
>=
gamma
)
?
d2
:
NAN
;
disp_r
[
v
*
width
+
u
]
=
((
min_disp1b
-
min_disp1
)
>=
gamma
)
?
d1
:
NAN
;
// TODO If disparity is 0.0f, perhaps
// Use previous value unless it conflicts with present
...
...
@@ -219,7 +222,7 @@ __global__ void consistency_kernel(float *d_sub_l, float *d_sub_r, PtrStepSz<flo
auto
b
=
d_sub_r
[
v
*
w
+
u
-
a
];
if
(
abs
(
a
-
b
)
<=
1.0
)
disp
(
v
,
u
)
=
abs
((
a
+
b
)
/
2
);
// was 1.0
else
disp
(
v
,
u
)
=
INFINITY
;
else
disp
(
v
,
u
)
=
NAN
;
//}
}
...
...
This diff is collapsed.
Click to expand it.
cv-node/src/middlebury.cpp
+
1
−
1
View file @
4376f7d4
...
...
@@ -195,7 +195,7 @@ void ftl::middlebury::evaldisp(const Mat &disp, const Mat >disp, const Mat &ma
if
(
gt
==
INFINITY
)
// unknown
continue
;
float
d
=
scale
*
disp
.
at
<
float
>
(
y
/
scale
,
x
/
scale
,
0
);
int
valid
=
(
d
!=
INFINITY
);
int
valid
=
(
d
!=
NAN
);
// NOTE: Is meant to be infinity in middlebury
if
(
valid
)
{
float
maxd
=
scale
*
maxdisp
;
// max disp range
d
=
max
(
0.0
f
,
min
(
maxd
,
d
));
// clip disps to max disp range
...
...
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