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
c47267ef
Commit
c47267ef
authored
Nov 29, 2016
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7538 from Tetragramm:CLAHEfix
parents
57aaec1e
17df65e6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
6 deletions
+13
-6
clahe.cpp
modules/imgproc/src/clahe.cpp
+9
-5
clahe.cl
modules/imgproc/src/opencl/clahe.cl
+4
-1
No files found.
modules/imgproc/src/clahe.cpp
View file @
c47267ef
...
...
@@ -212,8 +212,12 @@ namespace
for
(
int
i
=
0
;
i
<
histSize
;
++
i
)
tileHist
[
i
]
+=
redistBatch
;
for
(
int
i
=
0
;
i
<
residual
;
++
i
)
tileHist
[
i
]
++
;
if
(
residual
!=
0
)
{
int
residualStep
=
MAX
(
histSize
/
residual
,
1
);
for
(
int
i
=
0
;
i
<
histSize
&&
residual
>
0
;
i
+=
residualStep
,
residual
--
)
tileHist
[
i
]
++
;
}
}
// calc Lut
...
...
@@ -359,7 +363,7 @@ namespace
bool
useOpenCL
=
cv
::
ocl
::
useOpenCL
()
&&
_src
.
isUMat
()
&&
_src
.
dims
()
<=
2
&&
_src
.
type
()
==
CV_8UC1
;
#endif
int
histSize
=
_src
.
type
()
==
CV_8UC1
?
256
:
409
6
;
int
histSize
=
_src
.
type
()
==
CV_8UC1
?
256
:
6553
6
;
cv
::
Size
tileSize
;
cv
::
_InputArray
_srcForLut
;
...
...
@@ -416,7 +420,7 @@ namespace
if
(
_src
.
type
()
==
CV_8UC1
)
calcLutBody
=
cv
::
makePtr
<
CLAHE_CalcLut_Body
<
uchar
,
256
,
0
>
>
(
srcForLut
,
lut_
,
tileSize
,
tilesX_
,
clipLimit
,
lutScale
);
else
if
(
_src
.
type
()
==
CV_16UC1
)
calcLutBody
=
cv
::
makePtr
<
CLAHE_CalcLut_Body
<
ushort
,
4096
,
4
>
>
(
srcForLut
,
lut_
,
tileSize
,
tilesX_
,
clipLimit
,
lutScale
);
calcLutBody
=
cv
::
makePtr
<
CLAHE_CalcLut_Body
<
ushort
,
65536
,
0
>
>
(
srcForLut
,
lut_
,
tileSize
,
tilesX_
,
clipLimit
,
lutScale
);
else
CV_Error
(
CV_StsBadArg
,
"Unsupported type"
);
...
...
@@ -426,7 +430,7 @@ namespace
if
(
_src
.
type
()
==
CV_8UC1
)
interpolationBody
=
cv
::
makePtr
<
CLAHE_Interpolation_Body
<
uchar
,
0
>
>
(
src
,
dst
,
lut_
,
tileSize
,
tilesX_
,
tilesY_
);
else
if
(
_src
.
type
()
==
CV_16UC1
)
interpolationBody
=
cv
::
makePtr
<
CLAHE_Interpolation_Body
<
ushort
,
4
>
>
(
src
,
dst
,
lut_
,
tileSize
,
tilesX_
,
tilesY_
);
interpolationBody
=
cv
::
makePtr
<
CLAHE_Interpolation_Body
<
ushort
,
0
>
>
(
src
,
dst
,
lut_
,
tileSize
,
tilesX_
,
tilesY_
);
cv
::
parallel_for_
(
cv
::
Range
(
0
,
src
.
rows
),
*
interpolationBody
);
}
...
...
modules/imgproc/src/opencl/clahe.cl
View file @
c47267ef
...
...
@@ -201,7 +201,10 @@ __kernel void calcLut(__global __const uchar * src, const int srcStep,
tHistVal
+=
redistBatch
;
int
residual
=
totalClipped
-
redistBatch
*
256
;
if
(
tid
<
residual
)
int
rStep
=
256
/
residual
;
if
(
rStep
<
1
)
rStep
=
1
;
if
(
tid%rStep
==
0
&&
(
tid/rStep
)
<residual
)
++tHistVal
;
}
...
...
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