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
fd901d83
Commit
fd901d83
authored
Jun 28, 2012
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed #2108 (thanks to Vincent for the report and proposed solution)
parent
6a13c9ef
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
1 deletion
+29
-1
mat.hpp
modules/core/include/opencv2/core/mat.hpp
+2
-1
test_operations.cpp
modules/core/test/test_operations.cpp
+27
-0
No files found.
modules/core/include/opencv2/core/mat.hpp
View file @
fd901d83
...
...
@@ -759,7 +759,8 @@ inline SVD::SVD() {}
inline
SVD
::
SVD
(
InputArray
m
,
int
flags
)
{
operator
()(
m
,
flags
);
}
inline
void
SVD
::
solveZ
(
InputArray
m
,
OutputArray
_dst
)
{
SVD
svd
(
m
);
Mat
mtx
=
m
.
getMat
();
SVD
svd
(
mtx
,
(
mtx
.
rows
>=
mtx
.
cols
?
0
:
SVD
::
FULL_UV
));
_dst
.
create
(
svd
.
vt
.
cols
,
1
,
svd
.
vt
.
type
());
Mat
dst
=
_dst
.
getMat
();
svd
.
vt
.
row
(
svd
.
vt
.
rows
-
1
).
reshape
(
1
,
svd
.
vt
.
cols
).
copyTo
(
dst
);
...
...
modules/core/test/test_operations.cpp
View file @
fd901d83
...
...
@@ -75,6 +75,7 @@ protected:
bool
TestVec
();
bool
TestMatxMultiplication
();
bool
TestSubMatAccess
();
bool
TestSVD
();
bool
operations1
();
void
checkDiff
(
const
Mat
&
m1
,
const
Mat
&
m2
,
const
string
&
s
)
...
...
@@ -934,6 +935,29 @@ bool CV_OperationsTest::operations1()
return
true
;
}
bool
CV_OperationsTest
::
TestSVD
()
{
try
{
Mat
A
=
(
Mat_
<
double
>
(
3
,
4
)
<<
1
,
2
,
-
1
,
4
,
2
,
4
,
3
,
5
,
-
1
,
-
2
,
6
,
7
);
Mat
x
;
SVD
::
solveZ
(
A
,
x
);
if
(
norm
(
A
*
x
,
CV_C
)
>
FLT_EPSILON
)
throw
test_excep
();
SVD
svd
(
A
,
SVD
::
FULL_UV
);
if
(
norm
(
A
*
svd
.
vt
.
row
(
3
).
t
(),
CV_C
)
>
FLT_EPSILON
)
throw
test_excep
();
}
catch
(
const
test_excep
&
)
{
ts
->
set_failed_test_info
(
cvtest
::
TS
::
FAIL_MISMATCH
);
return
false
;
}
return
true
;
}
void
CV_OperationsTest
::
run
(
int
/* start_from */
)
{
if
(
!
TestMat
())
...
...
@@ -959,6 +983,9 @@ void CV_OperationsTest::run( int /* start_from */)
if
(
!
TestSubMatAccess
())
return
;
if
(
!
TestSVD
())
return
;
if
(
!
operations1
())
return
;
...
...
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