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
c2bd7ecb
Commit
c2bd7ecb
authored
4 years ago
by
Nicolas Pope
Browse files
Options
Downloads
Patches
Plain Diff
Limit carve distance
parent
69c7ce40
No related branches found
No related tags found
1 merge request
!354
Add full 3D MLS and carving
Pipeline
#33530
passed
4 years ago
Stage: all
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
components/renderers/cpp/src/carver.cu
+16
-5
16 additions, 5 deletions
components/renderers/cpp/src/carver.cu
with
16 additions
and
5 deletions
components/renderers/cpp/src/carver.cu
+
16
−
5
View file @
c2bd7ecb
#include
"carver.hpp"
__device__
inline
float
depthErrorCoef
(
const
ftl
::
rgbd
::
Camera
&
cam
,
float
disps
=
1.0
f
)
{
return
disps
/
(
cam
.
baseline
*
cam
.
fx
);
}
// ==== Reverse Verify Result ==================================================
__global__
void
reverse_check_kernel
(
...
...
@@ -17,9 +21,11 @@ __global__ void reverse_check_kernel(
if
(
x
<
0
||
x
>=
vintrin
.
width
||
y
<
0
||
y
>=
vintrin
.
height
)
return
;
float
d
=
depth_in
[
y
*
pitch4
+
x
];
const
float
err_coef
=
0.001
f
;
//depthErrorCoef(ointrin);
// FIXME: This is dangerous, need to check through alternates instead
while
(
true
)
{
int
count
=
10
;
// Allow max 2cm of carving.
while
(
--
count
>=
0
)
{
float3
campos
=
transformR
*
vintrin
.
screenToCam
(
x
,
y
,
d
);
int2
spos
=
ointrin
.
camToScreen
<
int2
>
(
campos
);
int
ox
=
spos
.
x
;
...
...
@@ -27,16 +33,21 @@ __global__ void reverse_check_kernel(
if
(
campos
.
z
>
0.0
f
&&
ox
>=
0
&&
ox
<
ointrin
.
width
&&
oy
>=
0
&&
oy
<
ointrin
.
height
)
{
float
d2
=
depth_original
[
oy
*
opitch4
+
ox
];
if
(
!
(
d2
<
ointrin
.
maxDepth
&&
d2
-
campos
.
z
>
d2
*
0.001
f
))
break
;
// TODO: Threshold comes from depth error characteristics
// If the value is significantly further then carve. Depth error
// is not always easy to calculate, depends on source.
if
(
!
(
d2
<
ointrin
.
maxDepth
&&
d2
-
campos
.
z
>
d2
*
d2
*
err_coef
))
break
;
d
+=
0.002
f
;
}
else
break
;
}
depth_in
[
y
*
pitch4
+
x
]
=
d
;
// Too much carving means just outright remove the point.
depth_in
[
y
*
pitch4
+
x
]
=
(
count
<
0
)
?
0.0
f
:
d
;
}
void
ftl
::
cuda
::
depth_carve
(
cv
::
cuda
::
GpuMat
&
depth_in
,
const
cv
::
cuda
::
GpuMat
&
depth_original
,
const
float4x4
&
transformR
,
const
ftl
::
rgbd
::
Camera
&
vintrin
,
const
ftl
::
rgbd
::
Camera
&
ointrin
,
cudaStream_t
stream
)
{
static
constexpr
int
THREADS_X
=
8
;
static
constexpr
int
THREADS_X
=
16
;
static
constexpr
int
THREADS_Y
=
8
;
const
dim3
gridSize
((
depth_in
.
cols
+
THREADS_X
-
1
)
/
THREADS_X
,
(
depth_in
.
rows
+
THREADS_Y
-
1
)
/
THREADS_Y
);
...
...
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