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
f992385c
Commit
f992385c
authored
5 years ago
by
Sebastian Hahta
Browse files
Options
Downloads
Patches
Plain Diff
optical flow error message
parent
19a3c41e
No related branches found
No related tags found
1 merge request
!157
feature/vision parameters
Pipeline
#16111
failed
5 years ago
Stage: all
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
components/rgbd-sources/src/algorithms/fixstars_sgm.cpp
+20
-34
20 additions, 34 deletions
components/rgbd-sources/src/algorithms/fixstars_sgm.cpp
components/rgbd-sources/src/offilter.cpp
+5
-0
5 additions, 0 deletions
components/rgbd-sources/src/offilter.cpp
with
25 additions
and
34 deletions
components/rgbd-sources/src/algorithms/fixstars_sgm.cpp
+
20
−
34
View file @
f992385c
...
@@ -168,20 +168,6 @@ bool FixstarsSGM::updateOFDisparityFilter() {
...
@@ -168,20 +168,6 @@ bool FixstarsSGM::updateOFDisparityFilter() {
void
FixstarsSGM
::
compute
(
ftl
::
rgbd
::
Frame
&
frame
,
cv
::
cuda
::
Stream
&
stream
)
void
FixstarsSGM
::
compute
(
ftl
::
rgbd
::
Frame
&
frame
,
cv
::
cuda
::
Stream
&
stream
)
{
{
/*if (!frame.hasChannel(ftl::rgbd::kChanLeftGray))
{
auto &rgb = frame.getChannel<GpuMat>(ftl::rgbd::kChanLeft, stream);
auto &gray = frame.setChannel<GpuMat>(ftl::rgbd::kChanLeftGray);
cv::cuda::cvtColor(rgb, gray, cv::COLOR_BGR2GRAY, 0, stream);
}
if (!frame.hasChannel(ftl::rgbd::kChanRightGray))
{
auto &rgb = frame.getChannel<GpuMat>(ftl::rgbd::kChanRight, stream);
auto &gray = frame.setChannel<GpuMat>(ftl::rgbd::kChanRightGray);
cv::cuda::cvtColor(rgb, gray, cv::COLOR_BGR2GRAY, 0, stream);
}*/
const
auto
&
l
=
frame
.
get
<
GpuMat
>
(
Channel
::
Left
);
const
auto
&
l
=
frame
.
get
<
GpuMat
>
(
Channel
::
Left
);
const
auto
&
r
=
frame
.
get
<
GpuMat
>
(
Channel
::
Right
);
const
auto
&
r
=
frame
.
get
<
GpuMat
>
(
Channel
::
Right
);
auto
&
disp
=
frame
.
create
<
GpuMat
>
(
Channel
::
Disparity
,
Format
<
float
>
(
l
.
size
()));
auto
&
disp
=
frame
.
create
<
GpuMat
>
(
Channel
::
Disparity
,
Format
<
float
>
(
l
.
size
()));
...
@@ -202,41 +188,41 @@ void FixstarsSGM::compute(ftl::rgbd::Frame &frame, cv::cuda::Stream &stream)
...
@@ -202,41 +188,41 @@ void FixstarsSGM::compute(ftl::rgbd::Frame &frame, cv::cuda::Stream &stream)
stream
.
waitForCompletion
();
stream
.
waitForCompletion
();
ssgm_
->
execute
(
lbw_
.
data
,
rbw_
.
data
,
dispt_
.
data
);
ssgm_
->
execute
(
lbw_
.
data
,
rbw_
.
data
,
dispt_
.
data
);
GpuMat
left_pixels
(
dispt_
,
cv
::
Rect
(
0
,
0
,
max_disp_
,
dispt_
.
rows
));
//
GpuMat left_pixels(dispt_, cv::Rect(0, 0, max_disp_, dispt_.rows));
left_pixels
.
setTo
(
0
);
//
left_pixels.setTo(0);
cv
::
cuda
::
threshold
(
dispt_
,
dispt_
,
4096.0
f
,
0.0
f
,
cv
::
THRESH_TOZERO_INV
,
stream
);
cv
::
cuda
::
threshold
(
dispt_
,
dispt_
,
4096.0
f
,
0.0
f
,
cv
::
THRESH_TOZERO_INV
,
stream
);
#ifdef HAVE_OPTFLOW
GpuMat
dispt_scaled
;
if
(
use_off_
)
{
if
(
l
.
size
()
!=
size_
)
frame
.
upload
(
Channel
::
Flow
,
stream
);
{
stream
.
waitForCompletion
();
scaleDisparity
(
l
.
size
(),
dispt_
,
dispt_scaled
,
stream
);
off_
.
filter
(
dispt_
,
frame
.
get
<
GpuMat
>
(
Channel
::
Flow
),
stream
);
}
else
{
dispt_scaled
=
dispt_
;
}
}
#endif
// TODO: filter could be applied after upscaling (to the upscaled disparity image)
// TODO: filter could be applied after upscaling (to the upscaled disparity image)
if
(
use_filter_
)
if
(
use_filter_
)
{
{
filter_
->
apply
(
filter_
->
apply
(
dispt_
,
dispt_
,
(
l
.
size
()
==
size_
)
?
l
:
l_scaled
,
l
,
dispt_
,
dispt_
,
stream
stream
);
);
}
}
GpuMat
dispt_scaled
;
if
(
l
.
size
()
!=
size_
)
{
scaleDisparity
(
l
.
size
(),
dispt_
,
dispt_scaled
,
stream
);
}
else
{
dispt_scaled
=
dispt_
;
}
dispt_scaled
.
convertTo
(
disp
,
CV_32F
,
1.0
f
/
16.0
f
,
stream
);
dispt_scaled
.
convertTo
(
disp
,
CV_32F
,
1.0
f
/
16.0
f
,
stream
);
#ifdef HAVE_OPTFLOW
// TODO: Optical flow filter expects CV_32F
if
(
use_off_
)
{
frame
.
upload
(
Channel
::
Flow
,
stream
);
stream
.
waitForCompletion
();
off_
.
filter
(
disp
,
frame
.
get
<
GpuMat
>
(
Channel
::
Flow
),
stream
);
}
#endif
}
}
void
FixstarsSGM
::
setMask
(
Mat
&
mask
)
{
void
FixstarsSGM
::
setMask
(
Mat
&
mask
)
{
...
...
This diff is collapsed.
Click to expand it.
components/rgbd-sources/src/offilter.cpp
+
5
−
0
View file @
f992385c
...
@@ -41,6 +41,11 @@ void OFDisparityFilter::filter(ftl::rgbd::Frame &frame, cv::cuda::Stream &stream
...
@@ -41,6 +41,11 @@ void OFDisparityFilter::filter(ftl::rgbd::Frame &frame, cv::cuda::Stream &stream
void
OFDisparityFilter
::
filter
(
cv
::
cuda
::
GpuMat
&
disp
,
cv
::
cuda
::
GpuMat
&
optflow
,
cv
::
cuda
::
Stream
&
stream
)
void
OFDisparityFilter
::
filter
(
cv
::
cuda
::
GpuMat
&
disp
,
cv
::
cuda
::
GpuMat
&
optflow
,
cv
::
cuda
::
Stream
&
stream
)
{
{
if
(
disp
.
type
!=
CV_32FC1
)
{
LOG
(
ERROR
)
<<
"Optical flow filter expects CV_32FC1 (TODO)"
;
return
;
}
ftl
::
cuda
::
optflow_filter
(
disp
,
optflow
,
disp_old_
,
n_max_
,
threshold_
,
stream
);
ftl
::
cuda
::
optflow_filter
(
disp
,
optflow
,
disp_old_
,
n_max_
,
threshold_
,
stream
);
}
}
...
...
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