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
5c5e752a
Commit
5c5e752a
authored
5 years ago
by
Sebastian Hahta
Browse files
Options
Downloads
Patches
Plain Diff
small adjustments and documentation
parent
e70bbf9e
No related branches found
No related tags found
2 merge requests
!105
CUDA optical flow smoothing
,
!103
feature/frame class
Pipeline
#13249
passed
5 years ago
Stage: all
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
components/rgbd-sources/include/ftl/rgbd/detail/source.hpp
+4
-0
4 additions, 0 deletions
components/rgbd-sources/include/ftl/rgbd/detail/source.hpp
components/rgbd-sources/include/ftl/rgbd/frame.hpp
+49
-22
49 additions, 22 deletions
components/rgbd-sources/include/ftl/rgbd/frame.hpp
with
53 additions
and
22 deletions
components/rgbd-sources/include/ftl/rgbd/detail/source.hpp
+
4
−
0
View file @
5c5e752a
...
@@ -10,6 +10,10 @@ namespace rgbd {
...
@@ -10,6 +10,10 @@ namespace rgbd {
class
Source
;
class
Source
;
// TODO: frame.hpp has to know the exact amount of channels
// (remove hardcoded value by providing exact value elsewhere).
// Possibly move channels to frame.hpp?
typedef
unsigned
int
channel_t
;
typedef
unsigned
int
channel_t
;
static
const
channel_t
kChanNone
=
0
;
static
const
channel_t
kChanNone
=
0
;
...
...
This diff is collapsed.
Click to expand it.
components/rgbd-sources/include/ftl/rgbd/frame.hpp
+
49
−
22
View file @
5c5e752a
...
@@ -4,24 +4,6 @@
...
@@ -4,24 +4,6 @@
#include
<ftl/configuration.hpp>
#include
<ftl/configuration.hpp>
#include
<opencv2/core.hpp>
#include
<opencv2/core.hpp>
// https://stackoverflow.com/a/31718095/
static
uint32_t
msbDeBruijn32
(
uint32_t
v
)
{
static
const
int
MultiplyDeBruijnBitPosition
[
32
]
=
{
0
,
9
,
1
,
10
,
13
,
21
,
2
,
29
,
11
,
14
,
16
,
18
,
22
,
25
,
3
,
30
,
8
,
12
,
20
,
28
,
15
,
17
,
24
,
7
,
19
,
27
,
23
,
6
,
26
,
5
,
4
,
31
};
v
|=
v
>>
1
;
// first round down to one less than a power of 2
v
|=
v
>>
2
;
v
|=
v
>>
4
;
v
|=
v
>>
8
;
v
|=
v
>>
16
;
return
MultiplyDeBruijnBitPosition
[(
uint32_t
)(
v
*
0x07C4ACDDU
)
>>
27
];
}
namespace
ftl
{
namespace
ftl
{
namespace
rgbd
{
namespace
rgbd
{
...
@@ -38,21 +20,66 @@ public:
...
@@ -38,21 +20,66 @@ public:
std
::
fill
(
available_
.
begin
(),
available_
.
end
(),
false
);
std
::
fill
(
available_
.
begin
(),
available_
.
end
(),
false
);
}
}
/* @brief Is there valid data in channel
/* @brief Is there valid data in channel. Must be checked if user
* is not providing the data and it is uncertain that valid data is
* available.
*/
*/
bool
hasChannel
(
const
ftl
::
rgbd
::
channel_t
&
channel
)
bool
hasChannel
(
const
ftl
::
rgbd
::
channel_t
&
channel
)
{
{
return
available_
[
msbDeBruijn32
(
channel
)];
return
available_
[
_channelIdx
(
channel
)];
}
}
/* @brief Get reference to the channel GpuMat
/* @brief Get reference to the channel GpuMat and marks it valid.
* If hasChannel() was false, user of this method must set
* valid data to the returned reference.
*/
*/
cv
::
cuda
::
GpuMat
&
getChannel
(
const
ftl
::
rgbd
::
channel_t
&
channel
)
cv
::
cuda
::
GpuMat
&
getChannel
(
const
ftl
::
rgbd
::
channel_t
&
channel
)
{
{
return
channels_
[
msbDeBruijn32
(
channel
)];
auto
idx
=
_channelIdx
(
channel
);
available_
[
idx
]
=
true
;
return
channels_
[
idx
];
}
}
private
:
private
:
static
size_t
_channelIdx
(
const
ftl
::
rgbd
::
channel_t
&
channel
)
{
switch
(
channel
)
{
case
kChanNone
:
return
0
;
case
kChanLeft
:
return
1
;
case
kChanDepth
:
return
2
;
case
kChanRight
:
return
3
;
case
kChanDisparity
:
return
4
;
case
kChanDeviation
:
return
5
;
case
kChanNormals
:
return
6
;
case
kChanConfidence
:
return
7
;
case
kChanFlow
:
return
8
;
case
kChanEnergy
:
return
9
;
default:
return
0
;
// should not happen
}
}
// https://stackoverflow.com/a/31718095/
// Indices for channels, requirs channels to have bitmask format
// (values are power of 2 and no missing values/gaps).
static
uint32_t
_msbDeBruijn32
(
uint32_t
v
)
{
static
const
int
MultiplyDeBruijnBitPosition
[
32
]
=
{
0
,
9
,
1
,
10
,
13
,
21
,
2
,
29
,
11
,
14
,
16
,
18
,
22
,
25
,
3
,
30
,
8
,
12
,
20
,
28
,
15
,
17
,
24
,
7
,
19
,
27
,
23
,
6
,
26
,
5
,
4
,
31
};
v
|=
v
>>
1
;
// first round down to one less than a power of 2
v
|=
v
>>
2
;
v
|=
v
>>
4
;
v
|=
v
>>
8
;
v
|=
v
>>
16
;
return
MultiplyDeBruijnBitPosition
[(
uint32_t
)(
v
*
0x07C4ACDDU
)
>>
27
];
}
std
::
vector
<
cv
::
cuda
::
GpuMat
>
channels_
;
std
::
vector
<
cv
::
cuda
::
GpuMat
>
channels_
;
std
::
vector
<
bool
>
available_
;
std
::
vector
<
bool
>
available_
;
};
};
...
...
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