Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
ed63c43c
Commit
ed63c43c
authored
May 15, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11519 from paroj:openni_color
parents
3104d2f7
95736443
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
36 deletions
+4
-36
openni_capture.cpp
samples/cpp/openni_capture.cpp
+4
-36
No files found.
samples/cpp/openni_capture.cpp
View file @
ed63c43c
...
@@ -26,7 +26,7 @@ static void help()
...
@@ -26,7 +26,7 @@ static void help()
<<
endl
;
<<
endl
;
}
}
static
void
colorizeDisparity
(
const
Mat
&
gray
,
Mat
&
rgb
,
double
maxDisp
=-
1.
f
,
float
S
=
1.
f
,
float
V
=
1.
f
)
static
void
colorizeDisparity
(
const
Mat
&
gray
,
Mat
&
rgb
,
double
maxDisp
=-
1.
f
)
{
{
CV_Assert
(
!
gray
.
empty
()
);
CV_Assert
(
!
gray
.
empty
()
);
CV_Assert
(
gray
.
type
()
==
CV_8UC1
);
CV_Assert
(
gray
.
type
()
==
CV_8UC1
);
...
@@ -42,41 +42,9 @@ static void colorizeDisparity( const Mat& gray, Mat& rgb, double maxDisp=-1.f, f
...
@@ -42,41 +42,9 @@ static void colorizeDisparity( const Mat& gray, Mat& rgb, double maxDisp=-1.f, f
if
(
maxDisp
<
1
)
if
(
maxDisp
<
1
)
return
;
return
;
for
(
int
y
=
0
;
y
<
gray
.
rows
;
y
++
)
Mat
tmp
;
{
convertScaleAbs
(
gray
,
tmp
,
255.
f
/
maxDisp
);
for
(
int
x
=
0
;
x
<
gray
.
cols
;
x
++
)
applyColorMap
(
tmp
,
rgb
,
COLORMAP_JET
);
{
uchar
d
=
gray
.
at
<
uchar
>
(
y
,
x
);
unsigned
int
H
=
((
uchar
)
maxDisp
-
d
)
*
240
/
(
uchar
)
maxDisp
;
unsigned
int
hi
=
(
H
/
60
)
%
6
;
float
f
=
H
/
60.
f
-
H
/
60
;
float
p
=
V
*
(
1
-
S
);
float
q
=
V
*
(
1
-
f
*
S
);
float
t
=
V
*
(
1
-
(
1
-
f
)
*
S
);
Point3f
res
;
if
(
hi
==
0
)
//R = V, G = t, B = p
res
=
Point3f
(
p
,
t
,
V
);
if
(
hi
==
1
)
// R = q, G = V, B = p
res
=
Point3f
(
p
,
V
,
q
);
if
(
hi
==
2
)
// R = p, G = V, B = t
res
=
Point3f
(
t
,
V
,
p
);
if
(
hi
==
3
)
// R = p, G = q, B = V
res
=
Point3f
(
V
,
q
,
p
);
if
(
hi
==
4
)
// R = t, G = p, B = V
res
=
Point3f
(
V
,
p
,
t
);
if
(
hi
==
5
)
// R = V, G = p, B = q
res
=
Point3f
(
q
,
p
,
V
);
uchar
b
=
(
uchar
)(
std
::
max
(
0.
f
,
std
::
min
(
res
.
x
,
1.
f
))
*
255.
f
);
uchar
g
=
(
uchar
)(
std
::
max
(
0.
f
,
std
::
min
(
res
.
y
,
1.
f
))
*
255.
f
);
uchar
r
=
(
uchar
)(
std
::
max
(
0.
f
,
std
::
min
(
res
.
z
,
1.
f
))
*
255.
f
);
rgb
.
at
<
Point3_
<
uchar
>
>
(
y
,
x
)
=
Point3_
<
uchar
>
(
b
,
g
,
r
);
}
}
}
}
static
float
getMaxDisparity
(
VideoCapture
&
capture
)
static
float
getMaxDisparity
(
VideoCapture
&
capture
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment