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
07fa62f0
Commit
07fa62f0
authored
Jan 25, 2012
by
Alexander Reshetnikov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some design code changes in new tests
parent
ea5d0155
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
70 deletions
+67
-70
test_homography.cpp
modules/calib3d/test/test_homography.cpp
+0
-0
test_countnonzero.cpp
modules/core/test/test_countnonzero.cpp
+0
-0
test_eigen.cpp
modules/core/test/test_eigen.cpp
+0
-0
test_boundingrect.cpp
modules/imgproc/test/test_boundingrect.cpp
+67
-70
No files found.
modules/calib3d/test/test_homography.cpp
View file @
07fa62f0
This diff is collapsed.
Click to expand it.
modules/core/test/test_countnonzero.cpp
View file @
07fa62f0
This diff is collapsed.
Click to expand it.
modules/core/test/test_eigen.cpp
View file @
07fa62f0
This diff is collapsed.
Click to expand it.
modules/imgproc/test/test_boundingrect.cpp
View file @
07fa62f0
#include "test_precomp.hpp"
#include "test_precomp.hpp"
#include <time.h>
#include <time.h>
#include <iostream>
#define IMGPROC_BOUNDINGRECT_ERROR_DIFF 1
#define IMGPROC_BOUNDINGRECT_ERROR_DIFF 1
...
@@ -11,94 +10,93 @@ using namespace std;
...
@@ -11,94 +10,93 @@ using namespace std;
class
CV_BoundingRectTest
:
public
cvtest
::
ArrayTest
class
CV_BoundingRectTest
:
public
cvtest
::
ArrayTest
{
{
public
:
public
:
CV_BoundingRectTest
();
CV_BoundingRectTest
();
~
CV_BoundingRectTest
();
~
CV_BoundingRectTest
();
protected
:
protected
:
void
run
(
int
);
void
run
(
int
);
private
:
private
:
template
<
class
T
>
void
generate_src_points
(
vector
<
Point_
<
T
>
>&
src
,
int
n
);
template
<
typename
T
>
void
generate_src_points
(
vector
<
Point_
<
T
>
>&
src
,
int
n
);
template
<
class
T
>
cv
::
Rect
get_bounding_rect
(
const
vector
<
Point_
<
T
>
>
src
);
template
<
typename
T
>
cv
::
Rect
get_bounding_rect
(
const
vector
<
Point_
<
T
>
>
src
);
template
<
class
T
>
bool
checking_function_work
(
vector
<
Point_
<
T
>
>&
src
,
int
type
);
template
<
typename
T
>
bool
checking_function_work
(
vector
<
Point_
<
T
>
>&
src
,
int
type
);
};
};
CV_BoundingRectTest
::
CV_BoundingRectTest
()
{}
CV_BoundingRectTest
::
CV_BoundingRectTest
()
{}
CV_BoundingRectTest
::~
CV_BoundingRectTest
()
{}
CV_BoundingRectTest
::~
CV_BoundingRectTest
()
{}
template
<
class
T
>
void
CV_BoundingRectTest
::
generate_src_points
(
vector
<
Point_
<
T
>
>&
src
,
int
n
)
template
<
typename
T
>
void
CV_BoundingRectTest
::
generate_src_points
(
vector
<
Point_
<
T
>
>&
src
,
int
n
)
{
{
src
.
clear
();
src
.
clear
();
for
(
size_t
i
=
0
;
i
<
n
;
++
i
)
for
(
int
i
=
0
;
i
<
n
;
++
i
)
src
.
push_back
(
Point_
<
T
>
(
cv
::
randu
<
T
>
(),
cv
::
randu
<
T
>
()));
src
.
push_back
(
Point_
<
T
>
(
cv
::
randu
<
T
>
(),
cv
::
randu
<
T
>
()));
}
}
template
<
class
T
>
cv
::
Rect
CV_BoundingRectTest
::
get_bounding_rect
(
const
vector
<
Point_
<
T
>
>
src
)
template
<
typename
T
>
cv
::
Rect
CV_BoundingRectTest
::
get_bounding_rect
(
const
vector
<
Point_
<
T
>
>
src
)
{
{
int
n
=
src
.
size
();
int
n
=
src
.
size
();
T
min_w
=
std
::
numeric_limits
<
T
>::
max
(),
max_w
=
std
::
numeric_limits
<
T
>::
min
();
T
min_w
=
std
::
numeric_limits
<
T
>::
max
(),
max_w
=
std
::
numeric_limits
<
T
>::
min
();
T
min_h
=
min_w
,
max_h
=
max_w
;
T
min_h
=
min_w
,
max_h
=
max_w
;
for
(
size_t
i
=
0
;
i
<
n
;
++
i
)
for
(
int
i
=
0
;
i
<
n
;
++
i
)
{
{
min_w
=
std
::
min
<
T
>
(
src
.
at
(
i
).
x
,
min_w
);
min_w
=
std
::
min
<
T
>
(
src
.
at
(
i
).
x
,
min_w
);
max_w
=
std
::
max
<
T
>
(
src
.
at
(
i
).
x
,
max_w
);
max_w
=
std
::
max
<
T
>
(
src
.
at
(
i
).
x
,
max_w
);
min_h
=
std
::
min
<
T
>
(
src
.
at
(
i
).
y
,
min_h
);
min_h
=
std
::
min
<
T
>
(
src
.
at
(
i
).
y
,
min_h
);
max_h
=
std
::
max
<
T
>
(
src
.
at
(
i
).
y
,
max_h
);
max_h
=
std
::
max
<
T
>
(
src
.
at
(
i
).
y
,
max_h
);
}
}
return
Rect
((
int
)
min_w
,
(
int
)
min_h
,
(
int
)(
floor
(
1.0
*
(
max_w
-
min_w
))
+
1
),
(
int
)(
floor
(
1.0
*
(
max_h
-
min_h
))
+
1
));
return
Rect
((
int
)
min_w
,
(
int
)
min_h
,
(
int
)(
floor
(
1.0
*
(
max_w
-
min_w
))
+
1
),
(
int
)(
floor
(
1.0
*
(
max_h
-
min_h
))
+
1
));
}
}
template
<
class
T
>
bool
CV_BoundingRectTest
::
checking_function_work
(
vector
<
Point_
<
T
>
>&
src
,
int
type
)
template
<
typename
T
>
bool
CV_BoundingRectTest
::
checking_function_work
(
vector
<
Point_
<
T
>
>&
src
,
int
type
)
{
{
const
int
MAX_COUNT_OF_POINTS
=
1000
;
const
int
MAX_COUNT_OF_POINTS
=
1000
;
const
int
N
=
10000
;
const
int
N
=
10000
;
for
(
int
k
=
0
;
k
<
N
;
++
k
)
for
(
int
k
=
0
;
k
<
N
;
++
k
)
{
{
RNG
&
rng
=
ts
->
get_rng
();
RNG
&
rng
=
ts
->
get_rng
();
int
n
=
rng
.
next
()
%
MAX_COUNT_OF_POINTS
+
1
;
int
n
=
rng
.
next
()
%
MAX_COUNT_OF_POINTS
+
1
;
generate_src_points
<
T
>
(
src
,
n
);
generate_src_points
<
T
>
(
src
,
n
);
cv
::
Rect
right
=
get_bounding_rect
<
T
>
(
src
);
cv
::
Rect
right
=
get_bounding_rect
<
T
>
(
src
);
cv
::
Rect
rect
[
2
]
=
{
boundingRect
(
src
),
boundingRect
(
Mat
(
src
))
};
cv
::
Rect
rect
[
2
]
=
{
boundingRect
(
src
),
boundingRect
(
Mat
(
src
))
};
for
(
int
i
=
0
;
i
<
2
;
++
i
)
if
(
rect
[
i
]
!=
right
)
for
(
int
i
=
0
;
i
<
2
;
++
i
)
if
(
rect
[
i
]
!=
right
)
{
{
cout
<<
endl
;
cout
<<
"Checking for the work of boundingRect function..."
<<
endl
;
cout
<<
endl
;
cout
<<
"Checking for the work of boundingRect function..."
<<
endl
;
cout
<<
"Type of src points: "
;
cout
<<
"Type of src points: "
;
switch
(
type
)
switch
(
type
)
{
{
case
0
:
{
cout
<<
"INT"
;
break
;}
case
0
:
{
cout
<<
"INT"
;
break
;}
case
1
:
{
cout
<<
"FLOAT"
;
break
;}
case
1
:
{
cout
<<
"FLOAT"
;
break
;}
case
2
:
{
cout
<<
"DOUBLE"
;
break
;}
default
:
break
;
default
:
break
;
}
}
cout
<<
endl
;
cout
<<
endl
;
cout
<<
"Src points are stored as "
;
if
(
i
==
0
)
cout
<<
"VECTOR"
<<
endl
;
else
cout
<<
"MAT"
<<
endl
;
cout
<<
"Src points are stored as "
;
if
(
i
==
0
)
cout
<<
"VECTOR"
<<
endl
;
else
cout
<<
"MAT"
<<
endl
;
cout
<<
"Number of points: "
<<
n
<<
endl
;
cout
<<
"Number of points: "
<<
n
<<
endl
;
cout
<<
"Right rect (x, y, w, h): ["
<<
right
.
x
<<
", "
<<
right
.
y
<<
", "
<<
right
.
width
<<
", "
<<
right
.
height
<<
"]"
<<
endl
;
cout
<<
"Right rect (x, y, w, h): ["
<<
right
.
x
<<
", "
<<
right
.
y
<<
", "
<<
right
.
width
<<
", "
<<
right
.
height
<<
"]"
<<
endl
;
cout
<<
"Result rect (x, y, w, h): ["
<<
rect
[
i
].
x
<<
", "
<<
rect
[
i
].
y
<<
", "
<<
rect
[
i
].
width
<<
", "
<<
rect
[
i
].
height
<<
"]"
<<
endl
;
cout
<<
"Result rect (x, y, w, h): ["
<<
rect
[
i
].
x
<<
", "
<<
rect
[
i
].
y
<<
", "
<<
rect
[
i
].
width
<<
", "
<<
rect
[
i
].
height
<<
"]"
<<
endl
;
cout
<<
endl
;
cout
<<
endl
;
CV_Error
(
IMGPROC_BOUNDINGRECT_ERROR_DIFF
,
MESSAGE_ERROR_DIFF
);
CV_Error
(
IMGPROC_BOUNDINGRECT_ERROR_DIFF
,
MESSAGE_ERROR_DIFF
);
return
false
;
return
false
;
}
}
}
}
return
true
;
return
true
;
}
}
void
CV_BoundingRectTest
::
run
(
int
)
void
CV_BoundingRectTest
::
run
(
int
)
{
{
vector
<
Point
>
src_veci
;
if
(
!
checking_function_work
(
src_veci
,
0
))
return
;
vector
<
Point
>
src_veci
;
if
(
!
checking_function_work
(
src_veci
,
0
))
return
;
vector
<
Point2f
>
src_vecf
;
checking_function_work
(
src_vecf
,
1
);
vector
<
Point2f
>
src_vecf
;
checking_function_work
(
src_vecf
,
1
);
}
}
TEST
(
Imgproc_BoundingRect
,
accuracy
)
{
CV_BoundingRectTest
test
;
test
.
safe_run
();
}
TEST
(
Imgproc_BoundingRect
,
accuracy
)
{
CV_BoundingRectTest
test
;
test
.
safe_run
();
}
\ No newline at end of file
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