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
9c3f790e
Commit
9c3f790e
authored
Mar 29, 2016
by
filipsladek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Box filter implemented for CV_32FC1
parent
1e1dc142
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
11 deletions
+28
-11
cudafilters.hpp
modules/cudafilters/include/opencv2/cudafilters.hpp
+1
-1
filtering.cpp
modules/cudafilters/src/filtering.cpp
+27
-10
No files found.
modules/cudafilters/include/opencv2/cudafilters.hpp
View file @
9c3f790e
...
@@ -89,7 +89,7 @@ public:
...
@@ -89,7 +89,7 @@ public:
/** @brief Creates a normalized 2D box filter.
/** @brief Creates a normalized 2D box filter.
@param srcType Input image type. Only CV_8UC1
and CV_8UC4
are supported for now.
@param srcType Input image type. Only CV_8UC1
, CV_8UC4 and CV_32FC1
are supported for now.
@param dstType Output image type. Only the same type as src is supported for now.
@param dstType Output image type. Only the same type as src is supported for now.
@param ksize Kernel size.
@param ksize Kernel size.
@param anchor Anchor point. The default value Point(-1, -1) means that the anchor is at the kernel
@param anchor Anchor point. The default value Point(-1, -1) means that the anchor is at the kernel
...
...
modules/cudafilters/src/filtering.cpp
View file @
9c3f790e
...
@@ -103,13 +103,14 @@ namespace
...
@@ -103,13 +103,14 @@ namespace
void
apply
(
InputArray
src
,
OutputArray
dst
,
Stream
&
stream
=
Stream
::
Null
());
void
apply
(
InputArray
src
,
OutputArray
dst
,
Stream
&
stream
=
Stream
::
Null
());
private
:
private
:
typedef
NppStatus
(
*
nppFilterBox_t
)(
const
Npp8u
*
pSrc
,
Npp32s
nSrcStep
,
Npp8u
*
pDst
,
Npp32s
nDstStep
,
typedef
NppStatus
(
*
nppFilterBox8U_t
)(
const
Npp8u
*
pSrc
,
Npp32s
nSrcStep
,
Npp8u
*
pDst
,
Npp32s
nDstStep
,
NppiSize
oSizeROI
,
NppiSize
oMaskSize
,
NppiPoint
oAnchor
);
typedef
NppStatus
(
*
nppFilterBox32F_t
)(
const
Npp32f
*
pSrc
,
Npp32s
nSrcStep
,
Npp32f
*
pDst
,
Npp32s
nDstStep
,
NppiSize
oSizeROI
,
NppiSize
oMaskSize
,
NppiPoint
oAnchor
);
NppiSize
oSizeROI
,
NppiSize
oMaskSize
,
NppiPoint
oAnchor
);
Size
ksize_
;
Size
ksize_
;
Point
anchor_
;
Point
anchor_
;
int
type_
;
int
type_
;
nppFilterBox_t
func_
;
int
borderMode_
;
int
borderMode_
;
Scalar
borderVal_
;
Scalar
borderVal_
;
GpuMat
srcBorder_
;
GpuMat
srcBorder_
;
...
@@ -118,14 +119,10 @@ namespace
...
@@ -118,14 +119,10 @@ namespace
NPPBoxFilter
::
NPPBoxFilter
(
int
srcType
,
int
dstType
,
Size
ksize
,
Point
anchor
,
int
borderMode
,
Scalar
borderVal
)
:
NPPBoxFilter
::
NPPBoxFilter
(
int
srcType
,
int
dstType
,
Size
ksize
,
Point
anchor
,
int
borderMode
,
Scalar
borderVal
)
:
ksize_
(
ksize
),
anchor_
(
anchor
),
type_
(
srcType
),
borderMode_
(
borderMode
),
borderVal_
(
borderVal
)
ksize_
(
ksize
),
anchor_
(
anchor
),
type_
(
srcType
),
borderMode_
(
borderMode
),
borderVal_
(
borderVal
)
{
{
static
const
nppFilterBox_t
funcs
[]
=
{
0
,
nppiFilterBox_8u_C1R
,
0
,
0
,
nppiFilterBox_8u_C4R
};
CV_Assert
(
srcType
==
CV_8UC1
||
srcType
==
CV_8UC4
||
srcType
==
CV_32FC1
);
CV_Assert
(
srcType
==
CV_8UC1
||
srcType
==
CV_8UC4
);
CV_Assert
(
dstType
==
srcType
);
CV_Assert
(
dstType
==
srcType
);
normalizeAnchor
(
anchor_
,
ksize
);
normalizeAnchor
(
anchor_
,
ksize
);
func_
=
funcs
[
CV_MAT_CN
(
srcType
)];
}
}
void
NPPBoxFilter
::
apply
(
InputArray
_src
,
OutputArray
_dst
,
Stream
&
_stream
)
void
NPPBoxFilter
::
apply
(
InputArray
_src
,
OutputArray
_dst
,
Stream
&
_stream
)
...
@@ -155,10 +152,30 @@ namespace
...
@@ -155,10 +152,30 @@ namespace
oAnchor
.
x
=
anchor_
.
x
;
oAnchor
.
x
=
anchor_
.
x
;
oAnchor
.
y
=
anchor_
.
y
;
oAnchor
.
y
=
anchor_
.
y
;
nppSafeCall
(
func_
(
srcRoi
.
ptr
<
Npp8u
>
(),
static_cast
<
int
>
(
srcRoi
.
step
),
const
int
depth
=
CV_MAT_DEPTH
(
type_
);
dst
.
ptr
<
Npp8u
>
(),
static_cast
<
int
>
(
dst
.
step
),
const
int
cn
=
CV_MAT_CN
(
type_
);
oSizeROI
,
oMaskSize
,
oAnchor
)
);
switch
(
depth
)
{
case
CV_8U
:
{
static
const
nppFilterBox8U_t
funcs8U
[]
=
{
0
,
nppiFilterBox_8u_C1R
,
0
,
0
,
nppiFilterBox_8u_C4R
};
const
nppFilterBox8U_t
func8U
=
funcs8U
[
cn
];
nppSafeCall
(
func8U
(
srcRoi
.
ptr
<
Npp8u
>
(),
static_cast
<
int
>
(
srcRoi
.
step
),
dst
.
ptr
<
Npp8u
>
(),
static_cast
<
int
>
(
dst
.
step
),
oSizeROI
,
oMaskSize
,
oAnchor
));
}
break
;
case
CV_32F
:
{
static
const
nppFilterBox32F_t
funcs32F
[]
=
{
0
,
nppiFilterBox_32f_C1R
,
0
,
0
,
0
};
const
nppFilterBox32F_t
func32F
=
funcs32F
[
cn
];
nppSafeCall
(
func32F
(
srcRoi
.
ptr
<
Npp32f
>
(),
static_cast
<
int
>
(
srcRoi
.
step
),
dst
.
ptr
<
Npp32f
>
(),
static_cast
<
int
>
(
dst
.
step
),
oSizeROI
,
oMaskSize
,
oAnchor
));
}
break
;
}
if
(
stream
==
0
)
if
(
stream
==
0
)
cudaSafeCall
(
cudaDeviceSynchronize
()
);
cudaSafeCall
(
cudaDeviceSynchronize
()
);
}
}
...
...
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