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
56b2b450
Commit
56b2b450
authored
Jun 22, 2015
by
LaurentBerger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A new constant in adaptivethreshold is created to calculate
gaussianBlur with CV_32F. hence rouding error are avoided
parent
945aa06f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
4 deletions
+14
-4
imgproc.hpp
modules/imgproc/include/opencv2/imgproc.hpp
+3
-1
thresh.cpp
modules/imgproc/src/thresh.cpp
+11
-3
No files found.
modules/imgproc/include/opencv2/imgproc.hpp
View file @
56b2b450
...
@@ -326,7 +326,9 @@ enum AdaptiveThresholdTypes {
...
@@ -326,7 +326,9 @@ enum AdaptiveThresholdTypes {
window) of the \f$\texttt{blockSize} \times \texttt{blockSize}\f$ neighborhood of \f$(x, y)\f$
window) of the \f$\texttt{blockSize} \times \texttt{blockSize}\f$ neighborhood of \f$(x, y)\f$
minus C . The default sigma (standard deviation) is used for the specified blockSize . See
minus C . The default sigma (standard deviation) is used for the specified blockSize . See
cv::getGaussianKernel*/
cv::getGaussianKernel*/
ADAPTIVE_THRESH_GAUSSIAN_C
=
1
ADAPTIVE_THRESH_GAUSSIAN_C
=
1
,
/** Like ADAPTIVE_THRESH_GAUSSIAN_C except that GaussianBlur use CV_32F for blurring to avoid rounding error*/
ADAPTIVE_THRESH_GAUSSIAN_C_FLOAT
=
2
};
};
//! cv::undistort mode
//! cv::undistort mode
...
...
modules/imgproc/src/thresh.cpp
View file @
56b2b450
...
@@ -1295,11 +1295,19 @@ void cv::adaptiveThreshold( InputArray _src, OutputArray _dst, double maxValue,
...
@@ -1295,11 +1295,19 @@ void cv::adaptiveThreshold( InputArray _src, OutputArray _dst, double maxValue,
if
(
src
.
data
!=
dst
.
data
)
if
(
src
.
data
!=
dst
.
data
)
mean
=
dst
;
mean
=
dst
;
if
(
method
==
ADAPTIVE_THRESH_MEAN_C
)
if
(
method
==
ADAPTIVE_THRESH_MEAN_C
)
boxFilter
(
src
,
mean
,
src
.
type
(),
Size
(
blockSize
,
blockSize
),
boxFilter
(
src
,
mean
,
src
.
type
(),
Size
(
blockSize
,
blockSize
),
Point
(
-
1
,
-
1
),
true
,
BORDER_REPLICATE
);
Point
(
-
1
,
-
1
),
true
,
BORDER_REPLICATE
);
else
if
(
method
==
ADAPTIVE_THRESH_GAUSSIAN_C
)
else
if
(
method
==
ADAPTIVE_THRESH_GAUSSIAN_C
)
GaussianBlur
(
src
,
mean
,
Size
(
blockSize
,
blockSize
),
0
,
0
,
BORDER_REPLICATE
);
GaussianBlur
(
src
,
mean
,
Size
(
blockSize
,
blockSize
),
0
,
0
,
BORDER_REPLICATE
);
else
if
(
method
==
ADAPTIVE_THRESH_GAUSSIAN_C_FLOAT
)
{
Mat
srcfloat
,
meanfloat
;
src
.
convertTo
(
srcfloat
,
CV_32F
);
meanfloat
=
srcfloat
;
GaussianBlur
(
srcfloat
,
meanfloat
,
Size
(
blockSize
,
blockSize
),
0
,
0
,
BORDER_REPLICATE
);
meanfloat
.
convertTo
(
dst
,
src
.
type
());
}
else
else
CV_Error
(
CV_StsBadFlag
,
"Unknown/unsupported adaptive threshold method"
);
CV_Error
(
CV_StsBadFlag
,
"Unknown/unsupported adaptive threshold method"
);
...
...
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