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
aa621d6f
Commit
aa621d6f
authored
Jul 05, 2017
by
Rostislav Vasilikhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
magic constants explained
parent
704c6882
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
0 deletions
+8
-0
color.cpp
modules/imgproc/src/color.cpp
+4
-0
cvtcolor.cl
modules/imgproc/src/opencl/cvtcolor.cl
+4
-0
No files found.
modules/imgproc/src/color.cpp
View file @
aa621d6f
...
...
@@ -7011,6 +7011,8 @@ struct RGB2Luv_b
const
float
*
_whitept
,
bool
_srgb
)
:
srccn
(
_srccn
),
cvt
(
3
,
blueIdx
,
_coeffs
,
_whitept
,
_srgb
)
{
//0.72033 = 255/(220+134), 96.525 = 134*255/(220+134)
//0.9732 = 255/(140+122), 136.259 = 140*255/(140+122)
#if CV_NEON
v_scale_inv
=
vdupq_n_f32
(
1.
f
/
255.
f
);
v_scale
=
vdupq_n_f32
(
2.55
f
);
...
...
@@ -7211,6 +7213,8 @@ struct Luv2RGB_b
const
float
*
_whitept
,
bool
_srgb
)
:
dstcn
(
_dstcn
),
cvt
(
3
,
blueIdx
,
_coeffs
,
_whitept
,
_srgb
)
{
// 1.388235294117647 = (220+134)/255
// 1.027450980392157 = (140+122)/255
#if CV_NEON
v_scale_inv
=
vdupq_n_f32
(
100.
f
/
255.
f
);
v_coeff1
=
vdupq_n_f32
(
1.388235294117647
f
);
...
...
modules/imgproc/src/opencl/cvtcolor.cl
View file @
aa621d6f
...
...
@@ -2035,7 +2035,9 @@ __kernel void BGR2Luv(__global const uchar * src, int src_step, int src_offset,
float
v
=
L*fma
(
2.25f,
Y*d,
-_vn
)
;
dst[0]
=
SAT_CAST
(
L
*
2.55f
)
;
//0.72033
=
255/
(
220+134
)
,
96.525
=
134*255/
(
220+134
)
dst[1]
=
SAT_CAST
(
fma
(
u,
0.72033898305084743f,
96.525423728813564f
))
;
//0.9732
=
255/
(
140+122
)
,
136.259
=
140*255/
(
140+122
)
dst[2]
=
SAT_CAST
(
fma
(
v,
0.9732824427480916f,
136.259541984732824f
))
;
++y
;
...
...
@@ -2137,7 +2139,9 @@ __kernel void Luv2BGR(__global const uchar * src, int src_step, int src_offset,
{
float
d,
X,
Y,
Z
;
float
L
=
src[0]*
(
100.f/255.f
)
;
//
1.388235294117647
=
(
220+134
)
/255
float
u
=
fma
(
convert_float
(
src[1]
)
,
1.388235294117647f,
-134.f
)
;
//
1.027450980392157
=
(
140+122
)
/255
float
v
=
fma
(
convert_float
(
src[2]
)
,
1.027450980392157f,
-
140.f
)
;
if
(
L
>=
8
)
{
...
...
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