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
7fb8e9d3
Commit
7fb8e9d3
authored
Mar 30, 2012
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added borderType to pyrDown, pyrUp & buildPyramid (patch #925)
parent
aff34adf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
17 deletions
+18
-17
imgproc.hpp
modules/imgproc/include/opencv2/imgproc/imgproc.hpp
+4
-3
pyramids.cpp
modules/imgproc/src/pyramids.cpp
+14
-14
No files found.
modules/imgproc/include/opencv2/imgproc/imgproc.hpp
View file @
7fb8e9d3
...
@@ -620,13 +620,14 @@ CV_EXPORTS_W void adaptiveThreshold( InputArray src, OutputArray dst,
...
@@ -620,13 +620,14 @@ CV_EXPORTS_W void adaptiveThreshold( InputArray src, OutputArray dst,
//! smooths and downsamples the image
//! smooths and downsamples the image
CV_EXPORTS_W
void
pyrDown
(
InputArray
src
,
OutputArray
dst
,
CV_EXPORTS_W
void
pyrDown
(
InputArray
src
,
OutputArray
dst
,
const
Size
&
dstsize
=
Size
());
const
Size
&
dstsize
=
Size
()
,
int
borderType
=
BORDER_DEFAULT
);
//! upsamples and smoothes the image
//! upsamples and smoothes the image
CV_EXPORTS_W
void
pyrUp
(
InputArray
src
,
OutputArray
dst
,
CV_EXPORTS_W
void
pyrUp
(
InputArray
src
,
OutputArray
dst
,
const
Size
&
dstsize
=
Size
());
const
Size
&
dstsize
=
Size
()
,
int
borderType
=
BORDER_DEFAULT
);
//! builds the gaussian pyramid using pyrDown() as a basic operation
//! builds the gaussian pyramid using pyrDown() as a basic operation
CV_EXPORTS
void
buildPyramid
(
InputArray
src
,
OutputArrayOfArrays
dst
,
int
maxlevel
);
CV_EXPORTS
void
buildPyramid
(
InputArray
src
,
OutputArrayOfArrays
dst
,
int
maxlevel
,
int
borderType
=
BORDER_DEFAULT
);
//! corrects lens distortion for the given camera matrix and distortion coefficients
//! corrects lens distortion for the given camera matrix and distortion coefficients
CV_EXPORTS_W
void
undistort
(
InputArray
src
,
OutputArray
dst
,
CV_EXPORTS_W
void
undistort
(
InputArray
src
,
OutputArray
dst
,
...
...
modules/imgproc/src/pyramids.cpp
View file @
7fb8e9d3
...
@@ -185,7 +185,7 @@ typedef NoVec<float, float> PyrDownVec_32f;
...
@@ -185,7 +185,7 @@ typedef NoVec<float, float> PyrDownVec_32f;
#endif
#endif
template
<
class
CastOp
,
class
VecOp
>
void
template
<
class
CastOp
,
class
VecOp
>
void
pyrDown_
(
const
Mat
&
_src
,
Mat
&
_dst
)
pyrDown_
(
const
Mat
&
_src
,
Mat
&
_dst
,
int
borderType
)
{
{
const
int
PD_SZ
=
5
;
const
int
PD_SZ
=
5
;
typedef
typename
CastOp
::
type1
WT
;
typedef
typename
CastOp
::
type1
WT
;
...
@@ -209,8 +209,8 @@ pyrDown_( const Mat& _src, Mat& _dst )
...
@@ -209,8 +209,8 @@ pyrDown_( const Mat& _src, Mat& _dst )
for
(
x
=
0
;
x
<=
PD_SZ
+
1
;
x
++
)
for
(
x
=
0
;
x
<=
PD_SZ
+
1
;
x
++
)
{
{
int
sx0
=
borderInterpolate
(
x
-
PD_SZ
/
2
,
ssize
.
width
,
BORDER_REFLECT_101
)
*
cn
;
int
sx0
=
borderInterpolate
(
x
-
PD_SZ
/
2
,
ssize
.
width
,
borderType
)
*
cn
;
int
sx1
=
borderInterpolate
(
x
+
width0
*
2
-
PD_SZ
/
2
,
ssize
.
width
,
BORDER_REFLECT_101
)
*
cn
;
int
sx1
=
borderInterpolate
(
x
+
width0
*
2
-
PD_SZ
/
2
,
ssize
.
width
,
borderType
)
*
cn
;
for
(
k
=
0
;
k
<
cn
;
k
++
)
for
(
k
=
0
;
k
<
cn
;
k
++
)
{
{
tabL
[
x
*
cn
+
k
]
=
sx0
+
k
;
tabL
[
x
*
cn
+
k
]
=
sx0
+
k
;
...
@@ -234,7 +234,7 @@ pyrDown_( const Mat& _src, Mat& _dst )
...
@@ -234,7 +234,7 @@ pyrDown_( const Mat& _src, Mat& _dst )
for
(
;
sy
<=
y
*
2
+
2
;
sy
++
)
for
(
;
sy
<=
y
*
2
+
2
;
sy
++
)
{
{
WT
*
row
=
buf
+
((
sy
-
sy0
)
%
PD_SZ
)
*
bufstep
;
WT
*
row
=
buf
+
((
sy
-
sy0
)
%
PD_SZ
)
*
bufstep
;
int
_sy
=
borderInterpolate
(
sy
,
ssize
.
height
,
BORDER_REFLECT_101
);
int
_sy
=
borderInterpolate
(
sy
,
ssize
.
height
,
borderType
);
const
T
*
src
=
(
const
T
*
)(
_src
.
data
+
_src
.
step
*
_sy
);
const
T
*
src
=
(
const
T
*
)(
_src
.
data
+
_src
.
step
*
_sy
);
int
limit
=
cn
;
int
limit
=
cn
;
const
int
*
tab
=
tabL
;
const
int
*
tab
=
tabL
;
...
@@ -308,7 +308,7 @@ pyrDown_( const Mat& _src, Mat& _dst )
...
@@ -308,7 +308,7 @@ pyrDown_( const Mat& _src, Mat& _dst )
template
<
class
CastOp
,
class
VecOp
>
void
template
<
class
CastOp
,
class
VecOp
>
void
pyrUp_
(
const
Mat
&
_src
,
Mat
&
_dst
)
pyrUp_
(
const
Mat
&
_src
,
Mat
&
_dst
,
int
borderType
)
{
{
const
int
PU_SZ
=
3
;
const
int
PU_SZ
=
3
;
typedef
typename
CastOp
::
type1
WT
;
typedef
typename
CastOp
::
type1
WT
;
...
@@ -397,11 +397,11 @@ pyrUp_( const Mat& _src, Mat& _dst )
...
@@ -397,11 +397,11 @@ pyrUp_( const Mat& _src, Mat& _dst )
}
}
}
}
typedef
void
(
*
PyrFunc
)(
const
Mat
&
,
Mat
&
);
typedef
void
(
*
PyrFunc
)(
const
Mat
&
,
Mat
&
,
int
);
}
}
void
cv
::
pyrDown
(
InputArray
_src
,
OutputArray
_dst
,
const
Size
&
_dsz
)
void
cv
::
pyrDown
(
InputArray
_src
,
OutputArray
_dst
,
const
Size
&
_dsz
,
int
borderType
)
{
{
Mat
src
=
_src
.
getMat
();
Mat
src
=
_src
.
getMat
();
Size
dsz
=
_dsz
==
Size
()
?
Size
((
src
.
cols
+
1
)
/
2
,
(
src
.
rows
+
1
)
/
2
)
:
_dsz
;
Size
dsz
=
_dsz
==
Size
()
?
Size
((
src
.
cols
+
1
)
/
2
,
(
src
.
rows
+
1
)
/
2
)
:
_dsz
;
...
@@ -409,7 +409,7 @@ void cv::pyrDown( InputArray _src, OutputArray _dst, const Size& _dsz )
...
@@ -409,7 +409,7 @@ void cv::pyrDown( InputArray _src, OutputArray _dst, const Size& _dsz )
Mat
dst
=
_dst
.
getMat
();
Mat
dst
=
_dst
.
getMat
();
#ifdef HAVE_TEGRA_OPTIMIZATION
#ifdef HAVE_TEGRA_OPTIMIZATION
if
(
tegra
::
pyrDown
(
src
,
dst
))
if
(
borderType
==
BORDER_DEFAULT
&&
tegra
::
pyrDown
(
src
,
dst
))
return
;
return
;
#endif
#endif
...
@@ -428,10 +428,10 @@ void cv::pyrDown( InputArray _src, OutputArray _dst, const Size& _dsz )
...
@@ -428,10 +428,10 @@ void cv::pyrDown( InputArray _src, OutputArray _dst, const Size& _dsz )
else
else
CV_Error
(
CV_StsUnsupportedFormat
,
""
);
CV_Error
(
CV_StsUnsupportedFormat
,
""
);
func
(
src
,
dst
);
func
(
src
,
dst
,
borderType
);
}
}
void
cv
::
pyrUp
(
InputArray
_src
,
OutputArray
_dst
,
const
Size
&
_dsz
)
void
cv
::
pyrUp
(
InputArray
_src
,
OutputArray
_dst
,
const
Size
&
_dsz
,
int
borderType
)
{
{
Mat
src
=
_src
.
getMat
();
Mat
src
=
_src
.
getMat
();
Size
dsz
=
_dsz
==
Size
()
?
Size
(
src
.
cols
*
2
,
src
.
rows
*
2
)
:
_dsz
;
Size
dsz
=
_dsz
==
Size
()
?
Size
(
src
.
cols
*
2
,
src
.
rows
*
2
)
:
_dsz
;
...
@@ -439,7 +439,7 @@ void cv::pyrUp( InputArray _src, OutputArray _dst, const Size& _dsz )
...
@@ -439,7 +439,7 @@ void cv::pyrUp( InputArray _src, OutputArray _dst, const Size& _dsz )
Mat
dst
=
_dst
.
getMat
();
Mat
dst
=
_dst
.
getMat
();
#ifdef HAVE_TEGRA_OPTIMIZATION
#ifdef HAVE_TEGRA_OPTIMIZATION
if
(
tegra
::
pyrUp
(
src
,
dst
))
if
(
borderType
==
BORDER_DEFAULT
&&
tegra
::
pyrUp
(
src
,
dst
))
return
;
return
;
#endif
#endif
...
@@ -458,16 +458,16 @@ void cv::pyrUp( InputArray _src, OutputArray _dst, const Size& _dsz )
...
@@ -458,16 +458,16 @@ void cv::pyrUp( InputArray _src, OutputArray _dst, const Size& _dsz )
else
else
CV_Error
(
CV_StsUnsupportedFormat
,
""
);
CV_Error
(
CV_StsUnsupportedFormat
,
""
);
func
(
src
,
dst
);
func
(
src
,
dst
,
borderType
);
}
}
void
cv
::
buildPyramid
(
InputArray
_src
,
OutputArrayOfArrays
_dst
,
int
maxlevel
)
void
cv
::
buildPyramid
(
InputArray
_src
,
OutputArrayOfArrays
_dst
,
int
maxlevel
,
int
borderType
)
{
{
Mat
src
=
_src
.
getMat
();
Mat
src
=
_src
.
getMat
();
_dst
.
create
(
maxlevel
+
1
,
1
,
0
);
_dst
.
create
(
maxlevel
+
1
,
1
,
0
);
_dst
.
getMatRef
(
0
)
=
src
;
_dst
.
getMatRef
(
0
)
=
src
;
for
(
int
i
=
1
;
i
<=
maxlevel
;
i
++
)
for
(
int
i
=
1
;
i
<=
maxlevel
;
i
++
)
pyrDown
(
_dst
.
getMatRef
(
i
-
1
),
_dst
.
getMatRef
(
i
)
);
pyrDown
(
_dst
.
getMatRef
(
i
-
1
),
_dst
.
getMatRef
(
i
)
,
Size
(),
borderType
);
}
}
CV_IMPL
void
cvPyrDown
(
const
void
*
srcarr
,
void
*
dstarr
,
int
_filter
)
CV_IMPL
void
cvPyrDown
(
const
void
*
srcarr
,
void
*
dstarr
,
int
_filter
)
...
...
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