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
82856150
Commit
82856150
authored
Feb 11, 2011
by
Alexey Spizhevoy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed warpAffine and warpPerspective under Linux
parent
8cf66439
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
17 deletions
+23
-17
imgproc_gpu.cpp
tests/gpu/src/imgproc_gpu.cpp
+23
-17
No files found.
tests/gpu/src/imgproc_gpu.cpp
View file @
82856150
...
...
@@ -64,7 +64,10 @@ protected:
virtual
int
test
(
const
Mat
&
img
)
=
0
;
int
CheckNorm
(
const
Mat
&
m1
,
const
Mat
&
m2
);
int
CheckNorm
(
const
Mat
&
m1
,
const
Mat
&
m2
);
// Checks whether two images are similar enough using normalized
// cross-correlation as an error measure
int
CheckSimilarity
(
const
Mat
&
m1
,
const
Mat
&
m2
,
float
max_err
=
1e-3
f
);
};
...
...
@@ -97,7 +100,7 @@ int CV_GpuImageProcTest::test32SC1(const Mat& img)
int
CV_GpuImageProcTest
::
test32FC1
(
const
Mat
&
img
)
{
cv
::
Mat
temp
,
img_C1
;
img
.
convertTo
(
temp
,
CV_32F
);
img
.
convertTo
(
temp
,
CV_32F
,
1.
f
/
255.
f
);
cvtColor
(
temp
,
img_C1
,
CV_BGR2GRAY
);
return
test
(
img_C1
);
...
...
@@ -317,12 +320,12 @@ struct CV_GpuNppImageWarpAffineTest : public CV_GpuImageProcTest
return
CvTS
::
OK
;
}
static
const
double
coeffs
[
2
][
3
]
=
{
{
cos
(
3.14
/
6
),
-
sin
(
3.14
/
6
),
100.0
},
{
sin
(
3.14
/
6
),
cos
(
3.14
/
6
),
-
100.0
}
};
Mat
M
(
2
,
3
,
CV_64F
,
(
void
*
)
coeffs
);
static
double
reflect
[
2
][
3
]
=
{
{
-
1
,
0
,
0
},
{
0
,
-
1
,
0
}
};
reflect
[
0
][
2
]
=
img
.
cols
;
reflect
[
1
][
2
]
=
img
.
rows
;
Mat
M
(
2
,
3
,
CV_64F
,
(
void
*
)
reflect
);
int
flags
[]
=
{
INTER_NEAREST
,
INTER_LINEAR
,
INTER_CUBIC
,
INTER_NEAREST
|
WARP_INVERSE_MAP
,
INTER_LINEAR
|
WARP_INVERSE_MAP
,
INTER_CUBIC
|
WARP_INVERSE_MAP
};
const
char
*
flags_str
[]
=
{
"INTER_NEAREST"
,
"INTER_LINEAR"
,
"INTER_CUBIC"
,
"INTER_NEAREST | WARP_INVERSE_MAP"
,
"INTER_LINEAR | WARP_INVERSE_MAP"
,
"INTER_CUBIC | WARP_INVERSE_MAP"
};
...
...
@@ -341,7 +344,9 @@ struct CV_GpuNppImageWarpAffineTest : public CV_GpuImageProcTest
GpuMat
gpudst
;
cv
::
gpu
::
warpAffine
(
gpu1
,
gpudst
,
M
,
gpu1
.
size
(),
flags
[
i
]);
if
(
CheckSimilarity
(
cpudst
,
gpudst
,
3e-3
f
)
!=
CvTS
::
OK
)
// Check inner parts (ignoring 1 pixel width border)
if
(
CheckSimilarity
(
cpudst
.
rowRange
(
1
,
cpudst
.
rows
-
1
).
colRange
(
1
,
cpudst
.
cols
-
1
),
gpudst
.
rowRange
(
1
,
gpudst
.
rows
-
1
).
colRange
(
1
,
gpudst
.
cols
-
1
))
!=
CvTS
::
OK
)
test_res
=
CvTS
::
FAIL_GENERIC
;
}
...
...
@@ -364,13 +369,12 @@ struct CV_GpuNppImageWarpPerspectiveTest : public CV_GpuImageProcTest
return
CvTS
::
OK
;
}
static
const
double
coeffs
[
3
][
3
]
=
{
{
cos
(
3.14
/
6
),
-
sin
(
3.14
/
6
),
100.0
},
{
sin
(
3.14
/
6
),
cos
(
3.14
/
6
),
-
100.0
},
{
0.0
,
0.0
,
1.0
}
};
Mat
M
(
3
,
3
,
CV_64F
,
(
void
*
)
coeffs
);
static
double
reflect
[
3
][
3
]
=
{
{
-
1
,
0
,
0
},
{
0
,
-
1
,
0
},
{
0
,
0
,
1
}};
reflect
[
0
][
2
]
=
img
.
cols
;
reflect
[
1
][
2
]
=
img
.
rows
;
Mat
M
(
3
,
3
,
CV_64F
,
(
void
*
)
reflect
);
int
flags
[]
=
{
INTER_NEAREST
,
INTER_LINEAR
,
INTER_CUBIC
,
INTER_NEAREST
|
WARP_INVERSE_MAP
,
INTER_LINEAR
|
WARP_INVERSE_MAP
,
INTER_CUBIC
|
WARP_INVERSE_MAP
};
const
char
*
flags_str
[]
=
{
"INTER_NEAREST"
,
"INTER_LINEAR"
,
"INTER_CUBIC"
,
"INTER_NEAREST | WARP_INVERSE_MAP"
,
"INTER_LINEAR | WARP_INVERSE_MAP"
,
"INTER_CUBIC | WARP_INVERSE_MAP"
};
...
...
@@ -389,7 +393,9 @@ struct CV_GpuNppImageWarpPerspectiveTest : public CV_GpuImageProcTest
GpuMat
gpudst
;
cv
::
gpu
::
warpPerspective
(
gpu1
,
gpudst
,
M
,
gpu1
.
size
(),
flags
[
i
]);
if
(
CheckSimilarity
(
cpudst
,
gpudst
,
3e-3
f
)
!=
CvTS
::
OK
)
// Check inner parts (ignoring 1 pixel width border)
if
(
CheckSimilarity
(
cpudst
.
rowRange
(
1
,
cpudst
.
rows
-
1
).
colRange
(
1
,
cpudst
.
cols
-
1
),
gpudst
.
rowRange
(
1
,
gpudst
.
rows
-
1
).
colRange
(
1
,
gpudst
.
cols
-
1
))
!=
CvTS
::
OK
)
test_res
=
CvTS
::
FAIL_GENERIC
;
}
...
...
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