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
3eaa8f14
Commit
3eaa8f14
authored
Dec 05, 2013
by
Ilya Lavrenov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added cv::intergal to T-API
parent
b16f0a25
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
138 additions
and
22 deletions
+138
-22
mat.hpp
modules/core/include/opencv2/core/mat.hpp
+2
-0
matrix.cpp
modules/core/src/matrix.cpp
+79
-0
miscellaneous_transformations.rst
modules/imgproc/doc/miscellaneous_transformations.rst
+6
-4
imgproc.hpp
modules/imgproc/include/opencv2/imgproc.hpp
+2
-2
integral_sqrsum.cl
modules/imgproc/src/opencl/integral_sqrsum.cl
+0
-0
integral_sum.cl
modules/imgproc/src/opencl/integral_sum.cl
+0
-0
sumpixels.cpp
modules/imgproc/src/sumpixels.cpp
+0
-0
test_imgproc.cpp
modules/imgproc/test/ocl/test_imgproc.cpp
+47
-14
ImgprocTest.java
...android_test/src/org/opencv/test/imgproc/ImgprocTest.java
+2
-2
No files found.
modules/core/include/opencv2/core/mat.hpp
View file @
3eaa8f14
...
...
@@ -129,6 +129,8 @@ public:
virtual
bool
isContinuous
(
int
i
=-
1
)
const
;
virtual
bool
empty
()
const
;
virtual
void
copyTo
(
const
_OutputArray
&
arr
)
const
;
virtual
size_t
offset
(
int
i
=-
1
)
const
;
virtual
size_t
step
(
int
i
=-
1
)
const
;
bool
isMat
()
const
;
bool
isUMat
()
const
;
bool
isMatVectot
()
const
;
...
...
modules/core/src/matrix.cpp
View file @
3eaa8f14
...
...
@@ -1792,6 +1792,85 @@ bool _InputArray::isContinuous(int i) const
return
false
;
}
size_t
_InputArray
::
offset
(
int
i
)
const
{
int
k
=
kind
();
if
(
k
==
MAT
)
{
CV_Assert
(
i
<
0
);
const
Mat
*
const
m
=
((
const
Mat
*
)
obj
);
return
(
size_t
)(
m
->
data
-
m
->
datastart
);
}
if
(
k
==
UMAT
)
{
CV_Assert
(
i
<
0
);
return
((
const
UMat
*
)
obj
)
->
offset
;
}
if
(
k
==
EXPR
||
k
==
MATX
||
k
==
STD_VECTOR
||
k
==
NONE
||
k
==
STD_VECTOR_VECTOR
)
return
0
;
if
(
k
==
STD_VECTOR_MAT
)
{
const
std
::
vector
<
Mat
>&
vv
=
*
(
const
std
::
vector
<
Mat
>*
)
obj
;
if
(
i
<
0
)
return
1
;
CV_Assert
(
i
<
(
int
)
vv
.
size
()
);
return
(
size_t
)(
vv
[
i
].
data
-
vv
[
i
].
datastart
);
}
if
(
k
==
GPU_MAT
)
{
CV_Assert
(
i
<
0
);
const
cuda
::
GpuMat
*
const
m
=
((
const
cuda
::
GpuMat
*
)
obj
);
return
(
size_t
)(
m
->
data
-
m
->
datastart
);
}
CV_Error
(
Error
::
StsNotImplemented
,
""
);
return
0
;
}
size_t
_InputArray
::
step
(
int
i
)
const
{
int
k
=
kind
();
if
(
k
==
MAT
)
{
CV_Assert
(
i
<
0
);
return
((
const
Mat
*
)
obj
)
->
step
;
}
if
(
k
==
UMAT
)
{
CV_Assert
(
i
<
0
);
return
((
const
UMat
*
)
obj
)
->
step
;
}
if
(
k
==
EXPR
||
k
==
MATX
||
k
==
STD_VECTOR
||
k
==
NONE
||
k
==
STD_VECTOR_VECTOR
)
return
0
;
if
(
k
==
STD_VECTOR_MAT
)
{
const
std
::
vector
<
Mat
>&
vv
=
*
(
const
std
::
vector
<
Mat
>*
)
obj
;
if
(
i
<
0
)
return
1
;
CV_Assert
(
i
<
(
int
)
vv
.
size
()
);
return
vv
[
i
].
step
;
}
if
(
k
==
GPU_MAT
)
{
CV_Assert
(
i
<
0
);
return
((
const
cuda
::
GpuMat
*
)
obj
)
->
step
;
}
CV_Error
(
Error
::
StsNotImplemented
,
""
);
return
0
;
}
void
_InputArray
::
copyTo
(
const
_OutputArray
&
arr
)
const
{
int
k
=
kind
();
...
...
modules/imgproc/doc/miscellaneous_transformations.rst
View file @
3eaa8f14
...
...
@@ -596,15 +596,15 @@ Calculates the integral of an image.
.. ocv:function:: void integral( InputArray src, OutputArray sum, int sdepth=-1 )
.. ocv:function:: void integral( InputArray src, OutputArray sum, OutputArray sqsum, int sdepth=-1 )
.. ocv:function:: void integral( InputArray src, OutputArray sum, OutputArray sqsum, int sdepth=-1
, int sqdepth=-1
)
.. ocv:function:: void integral( InputArray src, OutputArray sum, OutputArray sqsum, OutputArray tilted, int sdepth=-1 )
.. ocv:function:: void integral( InputArray src, OutputArray sum, OutputArray sqsum, OutputArray tilted, int sdepth=-1
, int sqdepth=-1
)
.. ocv:pyfunction:: cv2.integral(src[, sum[, sdepth]]) -> sum
.. ocv:pyfunction:: cv2.integral2(src[, sum[, sqsum[, sdepth]]]) -> sum, sqsum
.. ocv:pyfunction:: cv2.integral2(src[, sum[, sqsum[, sdepth
[, sqdepth]
]]]) -> sum, sqsum
.. ocv:pyfunction:: cv2.integral3(src[, sum[, sqsum[, tilted[, sdepth]]]]) -> sum, sqsum, tilted
.. ocv:pyfunction:: cv2.integral3(src[, sum[, sqsum[, tilted[, sdepth
[, sqdepth]
]]]]) -> sum, sqsum, tilted
.. ocv:cfunction:: void cvIntegral( const CvArr* image, CvArr* sum, CvArr* sqsum=NULL, CvArr* tilted_sum=NULL )
...
...
@@ -618,6 +618,8 @@ Calculates the integral of an image.
:param sdepth: desired depth of the integral and the tilted integral images, ``CV_32S``, ``CV_32F``, or ``CV_64F``.
:param sqdepth: desired depth of the integral image of squared pixel values, ``CV_32F`` or ``CV_64F``.
The functions calculate one or more integral images for the source image as follows:
.. math::
...
...
modules/imgproc/include/opencv2/imgproc.hpp
View file @
3eaa8f14
...
...
@@ -1241,12 +1241,12 @@ CV_EXPORTS_W void integral( InputArray src, OutputArray sum, int sdepth = -1 );
//! computes the integral image and integral for the squared image
CV_EXPORTS_AS
(
integral2
)
void
integral
(
InputArray
src
,
OutputArray
sum
,
OutputArray
sqsum
,
int
sdepth
=
-
1
);
OutputArray
sqsum
,
int
sdepth
=
-
1
,
int
sqdepth
=
-
1
);
//! computes the integral image, integral for the squared image and the tilted integral image
CV_EXPORTS_AS
(
integral3
)
void
integral
(
InputArray
src
,
OutputArray
sum
,
OutputArray
sqsum
,
OutputArray
tilted
,
int
sdepth
=
-
1
);
int
sdepth
=
-
1
,
int
sqdepth
=
-
1
);
//! adds image to the accumulator (dst += src). Unlike cv::add, dst and src can have different types.
CV_EXPORTS_W
void
accumulate
(
InputArray
src
,
InputOutputArray
dst
,
...
...
modules/imgproc/src/opencl/integral_sqrsum.cl
0 → 100644
View file @
3eaa8f14
This diff is collapsed.
Click to expand it.
modules/imgproc/src/opencl/integral_sum.cl
0 → 100644
View file @
3eaa8f14
This diff is collapsed.
Click to expand it.
modules/imgproc/src/sumpixels.cpp
View file @
3eaa8f14
This diff is collapsed.
Click to expand it.
modules/imgproc/test/ocl/test_imgproc.cpp
View file @
3eaa8f14
...
...
@@ -271,15 +271,50 @@ OCL_TEST_P(CornerHarris, DISABLED_Mat)
struct
Integral
:
public
ImgprocTestBase
{
int
sdepth
;
int
sdepth
,
sqdepth
;
TEST_DECLARE_OUTPUT_PARAMETER
(
dst2
)
virtual
void
SetUp
()
{
type
=
GET_PARAM
(
0
);
blockSize
=
GET_PARAM
(
1
);
sdepth
=
GET_PARAM
(
2
);
sdepth
=
GET_PARAM
(
1
);
s
q
depth
=
GET_PARAM
(
2
);
useRoi
=
GET_PARAM
(
3
);
}
virtual
void
random_roi
()
{
ASSERT_EQ
(
CV_MAT_CN
(
type
),
1
);
Size
roiSize
=
randomSize
(
1
,
MAX_VALUE
),
isize
=
Size
(
roiSize
.
width
+
1
,
roiSize
.
height
+
1
);
Border
srcBorder
=
randomBorder
(
0
,
useRoi
?
2
:
0
);
randomSubMat
(
src
,
src_roi
,
roiSize
,
srcBorder
,
type
,
5
,
256
);
Border
dstBorder
=
randomBorder
(
0
,
useRoi
?
2
:
0
);
randomSubMat
(
dst
,
dst_roi
,
isize
,
dstBorder
,
sdepth
,
5
,
16
);
Border
dst2Border
=
randomBorder
(
0
,
useRoi
?
2
:
0
);
randomSubMat
(
dst2
,
dst2_roi
,
isize
,
dst2Border
,
sqdepth
,
5
,
16
);
UMAT_UPLOAD_INPUT_PARAMETER
(
src
)
UMAT_UPLOAD_OUTPUT_PARAMETER
(
dst
)
UMAT_UPLOAD_OUTPUT_PARAMETER
(
dst2
)
}
void
Near2
(
double
threshold
=
0.0
,
bool
relative
=
false
)
{
if
(
relative
)
{
EXPECT_MAT_NEAR_RELATIVE
(
dst2
,
udst2
,
threshold
);
EXPECT_MAT_NEAR_RELATIVE
(
dst2_roi
,
udst2_roi
,
threshold
);
}
else
{
EXPECT_MAT_NEAR
(
dst2
,
udst2
,
threshold
);
EXPECT_MAT_NEAR
(
dst2_roi
,
udst2_roi
,
threshold
);
}
}
};
OCL_TEST_P
(
Integral
,
Mat1
)
...
...
@@ -297,19 +332,15 @@ OCL_TEST_P(Integral, Mat1)
OCL_TEST_P
(
Integral
,
Mat2
)
{
Mat
dst1
;
UMat
udst1
;
for
(
int
j
=
0
;
j
<
test_loop_times
;
j
++
)
{
random_roi
();
OCL_OFF
(
cv
::
integral
(
src_roi
,
dst_roi
,
dst
1
,
s
depth
));
OCL_ON
(
cv
::
integral
(
usrc_roi
,
udst_roi
,
udst
1
,
s
depth
));
OCL_OFF
(
cv
::
integral
(
src_roi
,
dst_roi
,
dst
2_roi
,
sdepth
,
sq
depth
));
OCL_ON
(
cv
::
integral
(
usrc_roi
,
udst_roi
,
udst
2_roi
,
sdepth
,
sq
depth
));
Near
();
if
(
cv
::
ocl
::
Device
::
getDefault
().
doubleFPConfig
()
>
0
)
EXPECT_MAT_NEAR
(
dst1
,
udst1
,
0.
);
sqdepth
==
CV_32F
?
Near2
(
1e-6
,
true
)
:
Near2
();
}
}
...
...
@@ -412,19 +443,21 @@ OCL_INSTANTIATE_TEST_CASE_P(Imgproc, EqualizeHist, Combine(
OCL_INSTANTIATE_TEST_CASE_P
(
Imgproc
,
CornerMinEigenVal
,
Combine
(
Values
((
MatType
)
CV_8UC1
,
(
MatType
)
CV_32FC1
),
Values
(
3
,
5
),
Values
((
int
)
BORDER_CONSTANT
,
(
int
)
BORDER_REPLICATE
,
(
int
)
BORDER_REFLECT
,
(
int
)
BORDER_REFLECT101
),
Values
((
BorderType
)
BORDER_CONSTANT
,
(
BorderType
)
BORDER_REPLICATE
,
(
BorderType
)
BORDER_REFLECT
,
(
BorderType
)
BORDER_REFLECT101
),
Bool
()));
OCL_INSTANTIATE_TEST_CASE_P
(
Imgproc
,
CornerHarris
,
Combine
(
Values
((
MatType
)
CV_8UC1
,
CV_32FC1
),
Values
(
3
,
5
),
Values
(
(
int
)
BORDER_CONSTANT
,
(
int
)
BORDER_REPLICATE
,
(
int
)
BORDER_REFLECT
,
(
int
)
BORDER_REFLECT_101
),
Values
(
(
BorderType
)
BORDER_CONSTANT
,
(
BorderType
)
BORDER_REPLICATE
,
(
BorderType
)
BORDER_REFLECT
,
(
BorderType
)
BORDER_REFLECT_101
),
Bool
()));
OCL_INSTANTIATE_TEST_CASE_P
(
Imgproc
,
Integral
,
Combine
(
Values
((
MatType
)
CV_8UC1
),
// TODO does not work with CV_32F, CV_64F
Values
(
0
),
// not used
Values
(
(
MatType
)
CV_32SC1
,
(
MatType
)
CV_32FC1
),
Values
(
CV_32SC1
,
CV_32FC1
),
// desired sdepth
Values
(
CV_32FC1
,
CV_64FC1
),
// desired sqdepth
Bool
()));
OCL_INSTANTIATE_TEST_CASE_P
(
Imgproc
,
Threshold
,
Combine
(
...
...
modules/java/android_test/src/org/opencv/test/imgproc/ImgprocTest.java
View file @
3eaa8f14
...
...
@@ -1225,7 +1225,7 @@ public class ImgprocTest extends OpenCVTestCase {
expSqsum
.
put
(
2
,
0
,
0
,
18
,
36
,
54
);
expSqsum
.
put
(
3
,
0
,
0
,
27
,
54
,
81
);
Imgproc
.
integral2
(
src
,
sum
,
sqsum
,
CvType
.
CV_64F
);
Imgproc
.
integral2
(
src
,
sum
,
sqsum
,
CvType
.
CV_64F
,
CvType
.
CV_64F
);
assertMatEqual
(
expSum
,
sum
,
EPS
);
assertMatEqual
(
expSqsum
,
sqsum
,
EPS
);
...
...
@@ -1274,7 +1274,7 @@ public class ImgprocTest extends OpenCVTestCase {
expTilted
.
put
(
0
,
0
,
0
,
0
);
expTilted
.
put
(
1
,
0
,
0
,
1
);
Imgproc
.
integral3
(
src
,
sum
,
sqsum
,
tilted
,
CvType
.
CV_64F
);
Imgproc
.
integral3
(
src
,
sum
,
sqsum
,
tilted
,
CvType
.
CV_64F
,
CvType
.
CV_64F
);
assertMatEqual
(
expSum
,
sum
,
EPS
);
assertMatEqual
(
expSqsum
,
sqsum
,
EPS
);
...
...
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