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
9dccfe2a
Commit
9dccfe2a
authored
Apr 17, 2019
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #13917 from sturkmen72:removed_c_api
parents
2b84039a
3d1dbd2c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
184 deletions
+5
-184
test_canny.cpp
modules/imgproc/test/test_canny.cpp
+0
-7
test_drawing.cpp
modules/imgproc/test/test_drawing.cpp
+0
-171
test_filter.cpp
modules/imgproc/test/test_filter.cpp
+5
-6
No files found.
modules/imgproc/test/test_canny.cpp
View file @
9dccfe2a
...
...
@@ -75,8 +75,6 @@ CV_CannyTest::CV_CannyTest(bool custom_deriv)
aperture_size
=
0
;
use_true_gradient
=
false
;
threshold1
=
threshold2
=
0
;
test_cpp
=
false
;
test_custom_deriv
=
custom_deriv
;
const
char
imgPath
[]
=
"shared/fruits.png"
;
...
...
@@ -158,11 +156,6 @@ void CV_CannyTest::run_func()
cvtest
::
filter2D
(
src
,
dy
,
CV_16S
,
dykernel
,
anchor
,
0
,
BORDER_REPLICATE
);
cv
::
Canny
(
dx
,
dy
,
_out
,
threshold1
,
threshold2
,
use_true_gradient
);
}
else
if
(
!
test_cpp
)
{
cvCanny
(
test_array
[
INPUT
][
0
],
test_array
[
OUTPUT
][
0
],
threshold1
,
threshold2
,
aperture_size
+
(
use_true_gradient
?
CV_CANNY_L2_GRADIENT
:
0
));
}
else
{
cv
::
Mat
_out
=
cv
::
cvarrToMat
(
test_array
[
OUTPUT
][
0
]);
...
...
modules/imgproc/test/test_drawing.cpp
View file @
9dccfe2a
...
...
@@ -245,176 +245,6 @@ int CV_DrawingTest_CPP::checkLineIterator( Mat& img )
return
0
;
}
class
CV_DrawingTest_C
:
public
CV_DrawingTest
{
public
:
CV_DrawingTest_C
()
{}
protected
:
virtual
void
draw
(
Mat
&
img
);
virtual
int
checkLineIterator
(
Mat
&
img
);
};
void
CV_DrawingTest_C
::
draw
(
Mat
&
_img
)
{
CvSize
imgSize
=
cvSize
(
600
,
400
);
_img
.
create
(
imgSize
,
CV_8UC3
);
CvMat
img
=
cvMat
(
_img
);
vector
<
CvPoint
>
polyline
(
4
);
polyline
[
0
]
=
cvPoint
(
0
,
0
);
polyline
[
1
]
=
cvPoint
(
imgSize
.
width
,
0
);
polyline
[
2
]
=
cvPoint
(
imgSize
.
width
,
imgSize
.
height
);
polyline
[
3
]
=
cvPoint
(
0
,
imgSize
.
height
);
CvPoint
*
pts
=
&
polyline
[
0
];
int
n
=
(
int
)
polyline
.
size
();
int
actualSize
=
0
;
cvFillPoly
(
&
img
,
&
pts
,
&
n
,
1
,
cvScalar
(
255
,
255
,
255
)
);
CvPoint
p1
=
cvPoint
(
1
,
1
),
p2
=
cvPoint
(
3
,
3
);
if
(
cvClipLine
(
imgSize
,
&
p1
,
&
p2
)
)
cvCircle
(
&
img
,
cvPoint
(
300
,
100
),
40
,
cvScalar
(
0
,
0
,
255
),
3
);
// draw
p1
=
cvPoint
(
1
,
1
),
p2
=
cvPoint
(
3
,
imgSize
.
height
+
1000
);
if
(
cvClipLine
(
imgSize
,
&
p1
,
&
p2
)
)
cvCircle
(
&
img
,
cvPoint
(
500
,
300
),
50
,
cvScalar
(
255
,
0
,
0
),
5
,
8
,
1
);
// draw
p1
=
cvPoint
(
imgSize
.
width
,
1
),
p2
=
cvPoint
(
imgSize
.
width
,
3
);
if
(
cvClipLine
(
imgSize
,
&
p1
,
&
p2
)
)
cvCircle
(
&
img
,
cvPoint
(
390
,
100
),
10
,
cvScalar
(
0
,
0
,
255
),
3
);
// not draw
p1
=
cvPoint
(
imgSize
.
width
-
1
,
1
),
p2
=
cvPoint
(
imgSize
.
width
,
3
);
if
(
cvClipLine
(
imgSize
,
&
p1
,
&
p2
)
)
cvEllipse
(
&
img
,
cvPoint
(
390
,
100
),
cvSize
(
20
,
30
),
60
,
0
,
220.0
,
cvScalar
(
0
,
200
,
0
),
4
);
//draw
CvBox2D
box
;
box
.
center
.
x
=
100
;
box
.
center
.
y
=
200
;
box
.
size
.
width
=
200
;
box
.
size
.
height
=
100
;
box
.
angle
=
160
;
cvEllipseBox
(
&
img
,
box
,
cvScalar
(
200
,
200
,
255
),
5
);
polyline
.
resize
(
9
);
pts
=
&
polyline
[
0
];
n
=
(
int
)
polyline
.
size
();
actualSize
=
cvEllipse2Poly
(
cvPoint
(
430
,
180
),
cvSize
(
100
,
150
),
30
,
0
,
150
,
&
polyline
[
0
],
20
);
CV_Assert
(
actualSize
==
n
);
cvPolyLine
(
&
img
,
&
pts
,
&
n
,
1
,
false
,
cvScalar
(
0
,
0
,
150
),
4
,
CV_AA
);
n
=
0
;
for
(
vector
<
CvPoint
>::
const_iterator
it
=
polyline
.
begin
();
n
<
(
int
)
polyline
.
size
()
-
1
;
++
it
,
n
++
)
{
cvLine
(
&
img
,
*
it
,
*
(
it
+
1
),
cvScalar
(
50
,
250
,
100
)
);
}
polyline
.
resize
(
19
);
pts
=
&
polyline
[
0
];
n
=
(
int
)
polyline
.
size
();
actualSize
=
cvEllipse2Poly
(
cvPoint
(
500
,
300
),
cvSize
(
50
,
80
),
0
,
0
,
180
,
&
polyline
[
0
],
10
);
CV_Assert
(
actualSize
==
n
);
cvPolyLine
(
&
img
,
&
pts
,
&
n
,
1
,
true
,
cvScalar
(
100
,
200
,
100
),
20
);
cvFillConvexPoly
(
&
img
,
pts
,
n
,
cvScalar
(
0
,
80
,
0
)
);
polyline
.
resize
(
8
);
// external rectengular
polyline
[
0
]
=
cvPoint
(
500
,
20
);
polyline
[
1
]
=
cvPoint
(
580
,
20
);
polyline
[
2
]
=
cvPoint
(
580
,
100
);
polyline
[
3
]
=
cvPoint
(
500
,
100
);
// internal rectangular
polyline
[
4
]
=
cvPoint
(
520
,
40
);
polyline
[
5
]
=
cvPoint
(
560
,
40
);
polyline
[
6
]
=
cvPoint
(
560
,
80
);
polyline
[
7
]
=
cvPoint
(
520
,
80
);
CvPoint
*
ppts
[]
=
{
&
polyline
[
0
],
&
polyline
[
0
]
+
4
};
int
pn
[]
=
{
4
,
4
};
cvFillPoly
(
&
img
,
ppts
,
pn
,
2
,
cvScalar
(
100
,
100
,
0
),
8
,
0
);
cvRectangle
(
&
img
,
cvPoint
(
0
,
300
),
cvPoint
(
50
,
398
),
cvScalar
(
0
,
0
,
255
)
);
string
text1
=
"OpenCV"
;
CvFont
font
;
cvInitFont
(
&
font
,
FONT_HERSHEY_SCRIPT_SIMPLEX
,
2
,
2
,
0
,
3
);
int
baseline
=
0
;
CvSize
textSize
=
{
0
,
0
};
cvGetTextSize
(
text1
.
c_str
(),
&
font
,
&
textSize
,
&
baseline
);
baseline
+=
font
.
thickness
;
CvPoint
textOrg
=
cvPoint
((
imgSize
.
width
-
textSize
.
width
)
/
2
,
(
imgSize
.
height
+
textSize
.
height
)
/
2
);
cvRectangle
(
&
img
,
cvPoint
(
textOrg
.
x
,
textOrg
.
y
+
baseline
),
cvPoint
(
textOrg
.
x
+
textSize
.
width
,
textOrg
.
y
-
textSize
.
height
),
cvScalar
(
0
,
0
,
255
));
cvLine
(
&
img
,
cvPoint
(
textOrg
.
x
,
textOrg
.
y
+
font
.
thickness
),
cvPoint
(
textOrg
.
x
+
textSize
.
width
,
textOrg
.
y
+
font
.
thickness
),
cvScalar
(
0
,
0
,
255
));
cvPutText
(
&
img
,
text1
.
c_str
(),
textOrg
,
&
font
,
cvScalar
(
150
,
0
,
150
)
);
int
dist
=
5
;
string
text2
=
"abcdefghijklmnopqrstuvwxyz1234567890"
;
CvScalar
color
=
cvScalar
(
200
,
0
,
0
);
cvInitFont
(
&
font
,
FONT_HERSHEY_SIMPLEX
,
0.5
,
0.5
,
0
,
1
,
CV_AA
);
cvGetTextSize
(
text2
.
c_str
(),
&
font
,
&
textSize
,
&
baseline
);
textOrg
=
cvPoint
(
5
,
5
+
textSize
.
height
+
dist
);
cvPutText
(
&
img
,
text2
.
c_str
(),
textOrg
,
&
font
,
color
);
cvInitFont
(
&
font
,
FONT_HERSHEY_PLAIN
,
1
,
1
,
0
,
1
,
CV_AA
);
cvGetTextSize
(
text2
.
c_str
(),
&
font
,
&
textSize
,
&
baseline
);
textOrg
=
cvPoint
(
textOrg
.
x
,
textOrg
.
y
+
textSize
.
height
+
dist
);
cvPutText
(
&
img
,
text2
.
c_str
(),
textOrg
,
&
font
,
color
);
cvInitFont
(
&
font
,
FONT_HERSHEY_DUPLEX
,
0.5
,
0.5
,
0
,
1
,
CV_AA
);
cvGetTextSize
(
text2
.
c_str
(),
&
font
,
&
textSize
,
&
baseline
);
textOrg
=
cvPoint
(
textOrg
.
x
,
textOrg
.
y
+
textSize
.
height
+
dist
);
cvPutText
(
&
img
,
text2
.
c_str
(),
textOrg
,
&
font
,
color
);
cvInitFont
(
&
font
,
FONT_HERSHEY_COMPLEX
,
0.5
,
0.5
,
0
,
1
,
CV_AA
);
cvGetTextSize
(
text2
.
c_str
(),
&
font
,
&
textSize
,
&
baseline
);
textOrg
=
cvPoint
(
textOrg
.
x
,
textOrg
.
y
+
textSize
.
height
+
dist
);
cvPutText
(
&
img
,
text2
.
c_str
(),
textOrg
,
&
font
,
color
);
cvInitFont
(
&
font
,
FONT_HERSHEY_TRIPLEX
,
0.5
,
0.5
,
0
,
1
,
CV_AA
);
cvGetTextSize
(
text2
.
c_str
(),
&
font
,
&
textSize
,
&
baseline
);
textOrg
=
cvPoint
(
textOrg
.
x
,
textOrg
.
y
+
textSize
.
height
+
dist
);
cvPutText
(
&
img
,
text2
.
c_str
(),
textOrg
,
&
font
,
color
);
cvInitFont
(
&
font
,
FONT_HERSHEY_COMPLEX_SMALL
,
1
,
1
,
0
,
1
,
CV_AA
);
cvGetTextSize
(
text2
.
c_str
(),
&
font
,
&
textSize
,
&
baseline
);
textOrg
=
cvPoint
(
textOrg
.
x
,
textOrg
.
y
+
textSize
.
height
+
dist
+
180
);
cvPutText
(
&
img
,
text2
.
c_str
(),
textOrg
,
&
font
,
color
);
cvInitFont
(
&
font
,
FONT_HERSHEY_SCRIPT_SIMPLEX
,
1
,
1
,
0
,
1
,
CV_AA
);
cvGetTextSize
(
text2
.
c_str
(),
&
font
,
&
textSize
,
&
baseline
);
textOrg
=
cvPoint
(
textOrg
.
x
,
textOrg
.
y
+
textSize
.
height
+
dist
);
cvPutText
(
&
img
,
text2
.
c_str
(),
textOrg
,
&
font
,
color
);
cvInitFont
(
&
font
,
FONT_HERSHEY_SCRIPT_COMPLEX
,
1
,
1
,
0
,
1
,
CV_AA
);
cvGetTextSize
(
text2
.
c_str
(),
&
font
,
&
textSize
,
&
baseline
);
textOrg
=
cvPoint
(
textOrg
.
x
,
textOrg
.
y
+
textSize
.
height
+
dist
);
cvPutText
(
&
img
,
text2
.
c_str
(),
textOrg
,
&
font
,
color
);
dist
=
15
;
cvInitFont
(
&
font
,
FONT_ITALIC
,
0.5
,
0.5
,
0
,
1
,
CV_AA
);
cvGetTextSize
(
text2
.
c_str
(),
&
font
,
&
textSize
,
&
baseline
);
textOrg
=
cvPoint
(
textOrg
.
x
,
textOrg
.
y
+
textSize
.
height
+
dist
);
cvPutText
(
&
img
,
text2
.
c_str
(),
textOrg
,
&
font
,
color
);
}
int
CV_DrawingTest_C
::
checkLineIterator
(
Mat
&
_img
)
{
CvLineIterator
it
;
CvMat
img
=
cvMat
(
_img
);
int
count
=
cvInitLineIterator
(
&
img
,
cvPoint
(
0
,
300
),
cvPoint
(
1000
,
300
),
&
it
);
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
Vec3b
v
=
(
Vec3b
)(
*
(
it
.
ptr
))
-
_img
.
at
<
Vec3b
>
(
300
,
i
);
float
err
=
(
float
)
cvtest
::
norm
(
v
,
NORM_L2
);
if
(
err
!=
0
)
{
ts
->
printf
(
ts
->
LOG
,
"CvLineIterator works incorrect"
);
ts
->
set_failed_test_info
(
cvtest
::
TS
::
FAIL_INVALID_OUTPUT
);
}
CV_NEXT_LINE_POINT
(
it
);
}
ts
->
set_failed_test_info
(
cvtest
::
TS
::
OK
);
return
0
;
}
class
CV_DrawingTest_Far
:
public
CV_DrawingTest_CPP
{
public
:
...
...
@@ -549,7 +379,6 @@ void CV_DrawingTest_Far::draw(Mat& img)
}
TEST
(
Drawing
,
cpp_regression
)
{
CV_DrawingTest_CPP
test
;
test
.
safe_run
();
}
TEST
(
Drawing
,
c_regression
)
{
CV_DrawingTest_C
test
;
test
.
safe_run
();
}
TEST
(
Drawing
,
far_regression
)
{
CV_DrawingTest_Far
test
;
test
.
safe_run
();
}
class
CV_FillConvexPolyTest
:
public
cvtest
::
BaseTest
...
...
modules/imgproc/test/test_filter.cpp
View file @
9dccfe2a
...
...
@@ -536,11 +536,9 @@ void CV_SobelTest::get_test_array_types_and_sizes( int test_case_idx,
void
CV_SobelTest
::
run_func
()
{
cvSobel
(
test_array
[
inplace
?
OUTPUT
:
INPUT
][
0
],
test_array
[
OUTPUT
][
0
],
dx
,
dy
,
_aperture_size
);
/*cv::Sobel( test_mat[inplace ? OUTPUT : INPUT][0],
cv
::
Sobel
(
test_mat
[
inplace
?
OUTPUT
:
INPUT
][
0
],
test_mat
[
OUTPUT
][
0
],
test_mat
[
OUTPUT
][
0
].
depth
(),
dx, dy, _aperture_size, 1, 0, border );
*/
dx
,
dy
,
_aperture_size
,
1
,
0
,
border
);
}
...
...
@@ -655,8 +653,9 @@ void CV_LaplaceTest::get_test_array_types_and_sizes( int test_case_idx,
void
CV_LaplaceTest
::
run_func
()
{
cvLaplace
(
test_array
[
inplace
?
OUTPUT
:
INPUT
][
0
],
test_array
[
OUTPUT
][
0
],
_aperture_size
);
cv
::
Laplacian
(
test_mat
[
inplace
?
OUTPUT
:
INPUT
][
0
],
test_mat
[
OUTPUT
][
0
],
test_mat
[
OUTPUT
][
0
].
depth
(),
_aperture_size
,
1
,
0
,
cv
::
BORDER_REPLICATE
);
}
...
...
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