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
63ef42cf
Commit
63ef42cf
authored
5 years ago
by
Nicolas Pope
Browse files
Options
Downloads
Plain Diff
Merge branch 'feature/sourcecolour' into 'master'
Add source colouring option See merge request nicolas.pope/ftl!168
parents
4a98bfc2
8ed13e24
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!168
Add source colouring option
Pipeline
#16419
passed
5 years ago
Stage: all
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
components/renderers/cpp/src/tri_render.cpp
+54
-1
54 additions, 1 deletion
components/renderers/cpp/src/tri_render.cpp
with
54 additions
and
1 deletion
components/renderers/cpp/src/tri_render.cpp
+
54
−
1
View file @
63ef42cf
...
...
@@ -398,6 +398,53 @@ void Triangular::_renderChannel(
_reprojectChannel
(
out
,
channel_in
,
channel_out
,
stream
);
}
/*
* H(Hue): 0 - 360 degree (integer)
* S(Saturation): 0 - 1.00 (double)
* V(Value): 0 - 1.00 (double)
*
* output[3]: Output, array size 3, int
*/
static
cv
::
Scalar
HSVtoRGB
(
int
H
,
double
S
,
double
V
)
{
double
C
=
S
*
V
;
double
X
=
C
*
(
1
-
abs
(
fmod
(
H
/
60.0
,
2
)
-
1
));
double
m
=
V
-
C
;
double
Rs
,
Gs
,
Bs
;
if
(
H
>=
0
&&
H
<
60
)
{
Rs
=
C
;
Gs
=
X
;
Bs
=
0
;
}
else
if
(
H
>=
60
&&
H
<
120
)
{
Rs
=
X
;
Gs
=
C
;
Bs
=
0
;
}
else
if
(
H
>=
120
&&
H
<
180
)
{
Rs
=
0
;
Gs
=
C
;
Bs
=
X
;
}
else
if
(
H
>=
180
&&
H
<
240
)
{
Rs
=
0
;
Gs
=
X
;
Bs
=
C
;
}
else
if
(
H
>=
240
&&
H
<
300
)
{
Rs
=
X
;
Gs
=
0
;
Bs
=
C
;
}
else
{
Rs
=
C
;
Gs
=
0
;
Bs
=
X
;
}
return
cv
::
Scalar
((
Bs
+
m
)
*
255
,
(
Gs
+
m
)
*
255
,
(
Rs
+
m
)
*
255
,
0
);
}
bool
Triangular
::
render
(
ftl
::
rgbd
::
VirtualSource
*
src
,
ftl
::
rgbd
::
Frame
&
out
)
{
SHARED_LOCK
(
scene_
->
mtx
,
lk
);
if
(
!
src
->
isReady
())
return
false
;
...
...
@@ -444,15 +491,21 @@ bool Triangular::render(ftl::rgbd::VirtualSource *src, ftl::rgbd::Frame &out) {
bool
show_discon
=
value
(
"show_discontinuity_mask"
,
false
);
bool
show_fill
=
value
(
"show_filled"
,
false
);
bool
colour_sources
=
value
(
"colour_sources"
,
false
);
temp_
.
createTexture
<
int
>
(
Channel
::
Depth
);
//temp_.get<GpuMat>(Channel::Normals).setTo(cv::Scalar(0.0f,0.0f,0.0f,0.0f), cvstream);
// Display mask values
// Display mask values
or otherwise alter colour image
for
(
int
i
=
0
;
i
<
scene_
->
frames
.
size
();
++
i
)
{
auto
&
f
=
scene_
->
frames
[
i
];
auto
s
=
scene_
->
sources
[
i
];
if
(
colour_sources
)
{
auto
colour
=
HSVtoRGB
(
360
/
scene_
->
frames
.
size
()
*
i
,
0.6
,
0.85
);
//(i == 0) ? cv::Scalar(255,0,0,0) : cv::Scalar(0,255,0,0);
f
.
get
<
GpuMat
>
(
Channel
::
Colour
).
setTo
(
colour
,
cvstream
);
}
if
(
f
.
hasChannel
(
Channel
::
Mask
))
{
if
(
show_discon
)
{
ftl
::
cuda
::
show_mask
(
f
.
getTexture
<
uchar4
>
(
Channel
::
Colour
),
f
.
getTexture
<
int
>
(
Channel
::
Mask
),
Mask
::
kMask_Discontinuity
,
make_uchar4
(
0
,
0
,
255
,
255
),
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