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
fbd9bfba
Commit
fbd9bfba
authored
Sep 10, 2012
by
Ilya Lavrenov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed some warnings and errors on windows
parent
b1b5e392
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
31 deletions
+29
-31
test_imgwarp_strict.cpp
modules/imgproc/test/test_imgwarp_strict.cpp
+29
-31
No files found.
modules/imgproc/test/test_imgwarp_strict.cpp
View file @
fbd9bfba
...
...
@@ -130,8 +130,8 @@ const char* CV_ImageWarpBaseTest::interpolation_to_string(int inter) const
Size
CV_ImageWarpBaseTest
::
randSize
(
RNG
&
rng
)
const
{
Size
size
;
size
.
width
=
s
aturate_cast
<
u
int
>
(
std
::
exp
(
rng
.
uniform
(
1.0
f
,
7.0
f
)));
size
.
height
=
s
aturate_cast
<
u
int
>
(
std
::
exp
(
rng
.
uniform
(
1.0
f
,
7.0
f
)));
size
.
width
=
s
tatic_cast
<
int
>
(
std
::
exp
(
rng
.
uniform
(
1.0
f
,
7.0
f
)));
size
.
height
=
s
tatic_cast
<
int
>
(
std
::
exp
(
rng
.
uniform
(
1.0
f
,
7.0
f
)));
return
size
;
}
...
...
@@ -433,7 +433,7 @@ void CV_Resize_Test::run_reference_func()
double
CV_Resize_Test
::
getWeight
(
double
a
,
double
b
,
int
x
)
{
float
w
=
std
::
min
<
double
>
(
x
+
1
,
b
)
-
std
::
max
<
double
>
(
x
,
a
);
float
w
=
std
::
min
(
static_cast
<
double
>
(
x
+
1
),
b
)
-
std
::
max
(
static_cast
<
double
>
(
x
)
,
a
);
CV_Assert
(
w
>=
0
);
return
w
;
}
...
...
@@ -453,7 +453,7 @@ void CV_Resize_Test::resize_area()
int
isy0
=
cvFloor
(
fsy0
),
isy1
=
std
::
min
(
cvFloor
(
fsy1
),
ssize
.
height
-
1
);
CV_Assert
(
isy1
<=
ssize
.
height
&&
isy0
<
ssize
.
height
);
float
fsx0
=
0
,
fsx1
=
scale_x
;
double
fsx0
=
0
,
fsx1
=
scale_x
;
for
(
int
dx
=
0
;
dx
<
dsize
.
width
;
++
dx
)
{
...
...
@@ -476,18 +476,18 @@ void CV_Resize_Test::resize_area()
double
wy
=
getWeight
(
fsy0
,
fsy1
,
sy
);
double
wx
=
getWeight
(
fsx0
,
fsx1
,
sx
);
double
w
=
wx
*
wy
;
xyD
[
r
]
+=
yS
[
sx
*
cn
+
r
]
*
w
;
xyD
[
r
]
+=
static_cast
<
float
>
(
yS
[
sx
*
cn
+
r
]
*
w
)
;
area
+=
w
;
}
}
CV_Assert
(
area
!=
0
);
// norming pixel
xyD
[
r
]
/=
area
;
xyD
[
r
]
=
static_cast
<
float
>
(
xyD
[
r
]
/
area
)
;
}
fsx1
=
std
::
min
<
double
>
((
fsx0
=
fsx1
)
+
scale_x
,
ssize
.
width
);
fsx1
=
std
::
min
((
fsx0
=
fsx1
)
+
scale_x
,
static_cast
<
double
>
(
ssize
.
width
)
);
}
fsy1
=
std
::
min
<
double
>
((
fsy0
=
fsy1
)
+
scale_y
,
ssize
.
height
);
fsy1
=
std
::
min
((
fsy0
=
fsy1
)
+
scale_y
,
static_cast
<
double
>
(
ssize
.
height
)
);
}
}
...
...
@@ -539,8 +539,8 @@ void CV_Resize_Test::resize_1d(const Mat& _src, Mat& _dst, int dy, const dim& _d
float
*
xyD
=
yD
+
dx
*
cn
;
const
float
*
xyS
=
_extended_src_row
.
ptr
<
float
>
(
0
)
+
(
isx
+
ksize
-
ofs
)
*
cn
;
float
w
[
ksize
];
inter_func
(
fsx
,
w
);
float
w
[
8
];
inter_func
(
static_cast
<
float
>
(
fsx
)
,
w
);
for
(
int
r
=
0
;
r
<
cn
;
++
r
)
{
...
...
@@ -669,8 +669,8 @@ void CV_Remap_Test::generate_test_data()
MatIterator_
<
Vec2s
>
begin_x
=
mapx
.
begin
<
Vec2s
>
(),
end_x
=
mapx
.
end
<
Vec2s
>
();
for
(
;
begin_x
!=
end_x
;
++
begin_x
)
{
begin_x
[
0
]
=
rng
.
uniform
(
static_cast
<
int
>
(
_n
),
std
::
max
(
src
.
cols
+
n
-
1
,
0
));
begin_x
[
1
]
=
rng
.
uniform
(
static_cast
<
int
>
(
_n
),
std
::
max
(
src
.
rows
+
n
-
1
,
0
));
begin_x
[
0
]
=
static_cast
<
short
>
(
rng
.
uniform
(
static_cast
<
int
>
(
_n
),
std
::
max
(
src
.
cols
+
n
-
1
,
0
)
));
begin_x
[
1
]
=
static_cast
<
short
>
(
rng
.
uniform
(
static_cast
<
int
>
(
_n
),
std
::
max
(
src
.
rows
+
n
-
1
,
0
)
));
}
if
(
interpolation
!=
INTER_NEAREST
)
...
...
@@ -684,7 +684,7 @@ void CV_Remap_Test::generate_test_data()
{
MatIterator_
<
ushort
>
begin_y
=
mapy
.
begin
<
ushort
>
(),
end_y
=
mapy
.
end
<
ushort
>
();
for
(
;
begin_y
!=
end_y
;
++
begin_y
)
begin_y
[
0
]
=
rng
.
uniform
(
0
,
1024
);
begin_y
[
0
]
=
static_cast
<
short
>
(
rng
.
uniform
(
0
,
1024
)
);
}
break
;
...
...
@@ -692,7 +692,7 @@ void CV_Remap_Test::generate_test_data()
{
MatIterator_
<
short
>
begin_y
=
mapy
.
begin
<
short
>
(),
end_y
=
mapy
.
end
<
short
>
();
for
(
;
begin_y
!=
end_y
;
++
begin_y
)
begin_y
[
0
]
=
rng
.
uniform
(
0
,
1024
);
begin_y
[
0
]
=
static_cast
<
short
>
(
rng
.
uniform
(
0
,
1024
)
);
}
break
;
}
...
...
@@ -749,7 +749,7 @@ void CV_Remap_Test::convert_maps()
if
(
interpolation
==
INTER_NEAREST
)
mapy
=
Mat
();
CV_Assert
((
(
interpolation
==
INTER_NEAREST
&&
!
mapy
.
data
)
||
mapy
.
type
()
==
CV_16UC1
||
CV_Assert
(((
interpolation
==
INTER_NEAREST
&&
!
mapy
.
data
)
||
mapy
.
type
()
==
CV_16UC1
||
mapy
.
type
()
==
CV_16SC1
)
&&
mapx
.
type
()
==
CV_16SC2
);
}
...
...
@@ -828,7 +828,7 @@ void CV_Remap_Test::remap_nearest(const Mat& _src, Mat& _dst)
{
if
(
borderType
==
BORDER_CONSTANT
)
for
(
int
r
=
0
;
r
<
cn
;
++
r
)
xyD
[
r
]
=
borderValue
[
r
]
;
xyD
[
r
]
=
saturate_cast
<
float
>
(
borderValue
[
r
])
;
else
{
sx
=
borderInterpolate
(
sx
,
ssize
.
width
,
borderType
);
...
...
@@ -849,16 +849,13 @@ void CV_Remap_Test::remap_generic(const Mat& _src, Mat& _dst)
{
CV_Assert
(
mapx
.
type
()
==
CV_16SC2
&&
mapy
.
type
()
==
CV_16UC1
);
int
ksize
;
if
(
interpolation
==
INTER_LINEAR
)
ksize
=
2
;
else
if
(
interpolation
==
INTER_CUBIC
)
int
ksize
=
2
;
if
(
interpolation
==
INTER_CUBIC
)
ksize
=
4
;
else
if
(
interpolation
==
INTER_LANCZOS4
)
ksize
=
8
;
else
ksize
=
0
;
assert
(
ksize
);
else
if
(
interpolation
!=
INTER_LINEAR
)
assert
(
0
);
int
ofs
=
(
ksize
/
2
)
-
1
;
CV_Assert
(
_src
.
depth
()
==
CV_32F
&&
_dst
.
type
()
==
_src
.
type
());
...
...
@@ -925,14 +922,14 @@ void CV_Remap_Test::remap_generic(const Mat& _src, Mat& _dst)
{
const
float
*
yS
=
_src
.
ptr
<
float
>
(
ar_y
[
i
]);
for
(
int
j
=
0
;
j
<
ksize
;
++
j
)
ix
[
i
]
+=
(
ar_x
[
j
]
>=
0
?
yS
[
ar_x
[
j
]
+
r
]
:
borderValue
[
r
])
*
w
[
j
]
;
ix
[
i
]
+=
saturate_cast
<
float
>
((
ar_x
[
j
]
>=
0
?
yS
[
ar_x
[
j
]
+
r
]
:
borderValue
[
r
])
*
w
[
j
])
;
}
else
for
(
int
j
=
0
;
j
<
ksize
;
++
j
)
ix
[
i
]
+=
borderValue
[
r
]
*
w
[
j
]
;
ix
[
i
]
+=
saturate_cast
<
float
>
(
borderValue
[
r
]
*
w
[
j
])
;
}
for
(
int
i
=
0
;
i
<
ksize
;
++
i
)
xyD
[
r
]
+=
w
[
ksize
+
i
]
*
ix
[
i
]
;
xyD
[
r
]
+=
saturate_cast
<
float
>
(
w
[
ksize
+
i
]
*
ix
[
i
])
;
}
}
}
...
...
@@ -1116,11 +1113,12 @@ void CV_WarpPerspective_Test::generate_test_data()
// generating the M 3x3 matrix
RNG
&
rng
=
ts
->
get_rng
();
Point2f
sp
[]
=
{
Point2f
(
0
,
0
),
Point2f
(
src
.
cols
,
0
),
Point2f
(
0
,
src
.
rows
),
Point2f
(
src
.
cols
,
src
.
rows
)
};
Point2f
dp
[]
=
{
Point2f
(
rng
.
uniform
(
0
,
src
.
cols
),
rng
.
uniform
(
0
,
src
.
rows
)),
Point2f
(
rng
.
uniform
(
0
,
src
.
cols
),
rng
.
uniform
(
0
,
src
.
rows
)),
Point2f
(
rng
.
uniform
(
0
,
src
.
cols
),
rng
.
uniform
(
0
,
src
.
rows
)),
Point2f
(
rng
.
uniform
(
0
,
src
.
cols
),
rng
.
uniform
(
0
,
src
.
rows
))
};
float
cols
=
static_cast
<
float
>
(
src
.
cols
),
rows
=
static_cast
<
float
>
(
src
.
rows
);
Point2f
sp
[]
=
{
Point2f
(
0.0
f
,
0.0
f
),
Point2f
(
cols
,
0.0
f
),
Point2f
(
0.0
f
,
rows
),
Point2f
(
cols
,
rows
)
};
Point2f
dp
[]
=
{
Point2f
(
rng
.
uniform
(
0.0
f
,
cols
),
rng
.
uniform
(
0.0
f
,
rows
)),
Point2f
(
rng
.
uniform
(
0.0
f
,
cols
),
rng
.
uniform
(
0.0
f
,
rows
)),
Point2f
(
rng
.
uniform
(
0.0
f
,
cols
),
rng
.
uniform
(
0.0
f
,
rows
)),
Point2f
(
rng
.
uniform
(
0.0
f
,
cols
),
rng
.
uniform
(
0.0
f
,
rows
))
};
M
=
getPerspectiveTransform
(
sp
,
dp
);
static
const
int
depths
[]
=
{
CV_32F
,
CV_64F
};
...
...
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