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
9f1c6411
Commit
9f1c6411
authored
Jun 18, 2015
by
Seon-Wook Park
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
spatialGradient: Add test class and Sobel proxy method
parent
12e6efc6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
126 additions
and
0 deletions
+126
-0
imgproc.hpp
modules/imgproc/include/opencv2/imgproc.hpp
+9
-0
spatialgradient.cpp
modules/imgproc/src/spatialgradient.cpp
+56
-0
test_filter.cpp
modules/imgproc/test/test_filter.cpp
+61
-0
No files found.
modules/imgproc/include/opencv2/imgproc.hpp
View file @
9f1c6411
...
...
@@ -1369,6 +1369,15 @@ CV_EXPORTS_W void Sobel( InputArray src, OutputArray dst, int ddepth,
double
scale
=
1
,
double
delta
=
0
,
int
borderType
=
BORDER_DEFAULT
);
/** @brief TODO
TODO
*/
CV_EXPORTS_W
void
spatialGradient
(
InputArray
src
,
OutputArray
dx
,
OutputArray
dy
,
int
ksize
);
/** @brief Calculates the first x- or y- image derivative using Scharr operator.
The function computes the first x- or y- spatial image derivative using the Scharr operator. The
...
...
modules/imgproc/src/spatialgradient.cpp
0 → 100644
View file @
9f1c6411
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include "precomp.hpp"
namespace
cv
{
void
spatialGradient
(
InputArray
src
,
OutputArray
dx
,
OutputArray
dy
,
int
ksize
)
{
// TODO: Vectorize using hal intrinsics
Sobel
(
src
,
dx
,
CV_16S
,
1
,
0
,
3
);
Sobel
(
src
,
dy
,
CV_16S
,
0
,
1
,
3
);
}
}
modules/imgproc/test/test_filter.cpp
View file @
9f1c6411
...
...
@@ -552,6 +552,66 @@ void CV_SobelTest::prepare_to_validation( int /*test_case_idx*/ )
}
/////////////// spatialGradient ///////////////
class
CV_SpatialGradientTest
:
public
CV_DerivBaseTest
{
public
:
CV_SpatialGradientTest
();
protected
:
void
prepare_to_validation
(
int
test_case_idx
);
void
run_func
();
void
get_test_array_types_and_sizes
(
int
test_case_idx
,
vector
<
vector
<
Size
>
>&
sizes
,
vector
<
vector
<
int
>
>&
types
);
int
ksize
;
};
CV_SpatialGradientTest
::
CV_SpatialGradientTest
()
{
test_array
[
OUTPUT
].
push_back
(
NULL
);
test_array
[
REF_OUTPUT
].
push_back
(
NULL
);
inplace
=
false
;
}
void
CV_SpatialGradientTest
::
get_test_array_types_and_sizes
(
int
test_case_idx
,
vector
<
vector
<
Size
>
>&
sizes
,
vector
<
vector
<
int
>
>&
types
)
{
CV_DerivBaseTest
::
get_test_array_types_and_sizes
(
test_case_idx
,
sizes
,
types
);
sizes
[
OUTPUT
][
1
]
=
sizes
[
REF_OUTPUT
][
1
]
=
sizes
[
OUTPUT
][
0
];
// Only CV_16S1 for now
types
[
INPUT
][
0
]
=
types
[
OUTPUT
][
0
]
=
types
[
OUTPUT
][
1
]
=
types
[
REF_OUTPUT
][
0
]
=
types
[
REF_OUTPUT
][
1
]
=
CV_MAKETYPE
(
CV_16S
,
1
);
ksize
=
3
;
}
void
CV_SpatialGradientTest
::
run_func
()
{
spatialGradient
(
cvarrToMat
(
test_array
[
INPUT
][
0
]),
cvarrToMat
(
test_array
[
OUTPUT
][
0
]),
cvarrToMat
(
test_array
[
OUTPUT
][
1
]),
ksize
);
}
void
CV_SpatialGradientTest
::
prepare_to_validation
(
int
/*test_case_idx*/
)
{
int
dx
,
dy
;
dx
=
1
;
dy
=
0
;
Sobel
(
test_mat
[
INPUT
][
0
],
test_mat
[
REF_OUTPUT
][
0
],
CV_16SC1
,
dx
,
dy
,
ksize
);
dx
=
0
;
dy
=
1
;
Sobel
(
test_mat
[
INPUT
][
0
],
test_mat
[
REF_OUTPUT
][
1
],
CV_16SC1
,
dx
,
dy
,
ksize
);
}
/////////////// laplace ///////////////
class
CV_LaplaceTest
:
public
CV_DerivBaseTest
...
...
@@ -1773,6 +1833,7 @@ TEST(Imgproc_Dilate, accuracy) { CV_DilateTest test; test.safe_run(); }
TEST
(
Imgproc_MorphologyEx
,
accuracy
)
{
CV_MorphExTest
test
;
test
.
safe_run
();
}
TEST
(
Imgproc_Filter2D
,
accuracy
)
{
CV_FilterTest
test
;
test
.
safe_run
();
}
TEST
(
Imgproc_Sobel
,
accuracy
)
{
CV_SobelTest
test
;
test
.
safe_run
();
}
TEST
(
Imgproc_SpatialGradient
,
accuracy
)
{
CV_SpatialGradientTest
test
;
test
.
safe_run
();
}
TEST
(
Imgproc_Laplace
,
accuracy
)
{
CV_LaplaceTest
test
;
test
.
safe_run
();
}
TEST
(
Imgproc_Blur
,
accuracy
)
{
CV_BlurTest
test
;
test
.
safe_run
();
}
TEST
(
Imgproc_GaussianBlur
,
accuracy
)
{
CV_GaussianBlurTest
test
;
test
.
safe_run
();
}
...
...
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