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
c6e6d4c8
Commit
c6e6d4c8
authored
Jan 26, 2016
by
Suleyman TURKMEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update pca.cpp
parent
1cd3c6f3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
14 deletions
+19
-14
core.hpp
modules/core/include/opencv2/core.hpp
+13
-7
pca.cpp
modules/core/src/pca.cpp
+6
-7
No files found.
modules/core/include/opencv2/core.hpp
View file @
c6e6d4c8
...
@@ -2316,11 +2316,11 @@ public:
...
@@ -2316,11 +2316,11 @@ public:
The operator performs %PCA of the supplied dataset. It is safe to reuse
The operator performs %PCA of the supplied dataset. It is safe to reuse
the same PCA structure for multiple datasets. That is, if the structure
the same PCA structure for multiple datasets. That is, if the structure
has been previously used with another dataset, the existing internal
has been previously used with another dataset, the existing internal
data is reclaimed and the new
eigenvalues, @ref eigenvectors ,
and @ref
data is reclaimed and the new
@ref eigenvalues, @ref eigenvectors
and @ref
mean are allocated and computed.
mean are allocated and computed.
The computed eigenvalues are sorted from the largest to the smallest and
The computed
@ref
eigenvalues are sorted from the largest to the smallest and
the corresponding eigenvectors are stored as eigenvectors rows.
the corresponding
@ref
eigenvectors are stored as eigenvectors rows.
@param data input samples stored as the matrix rows or as the matrix
@param data input samples stored as the matrix rows or as the matrix
columns.
columns.
...
@@ -2400,11 +2400,17 @@ public:
...
@@ -2400,11 +2400,17 @@ public:
*/
*/
void
backProject
(
InputArray
vec
,
OutputArray
result
)
const
;
void
backProject
(
InputArray
vec
,
OutputArray
result
)
const
;
/** @brief write
and load PCA matrix
/** @brief write
PCA objects
*/
Writes @ref eigenvalues @ref eigenvectors and @ref mean to specified FileStorage
void
write
(
FileStorage
&
fs
)
const
;
*/
void
read
(
const
FileNode
&
fs
);
void
write
(
FileStorage
&
fs
)
const
;
/** @brief load PCA objects
Loads @ref eigenvalues @ref eigenvectors and @ref mean from specified FileNode
*/
void
read
(
const
FileNode
&
fn
);
Mat
eigenvectors
;
//!< eigenvectors of the covariation matrix
Mat
eigenvectors
;
//!< eigenvectors of the covariation matrix
Mat
eigenvalues
;
//!< eigenvalues of the covariation matrix
Mat
eigenvalues
;
//!< eigenvalues of the covariation matrix
...
...
modules/core/src/pca.cpp
View file @
c6e6d4c8
...
@@ -158,15 +158,14 @@ void PCA::write(FileStorage& fs ) const
...
@@ -158,15 +158,14 @@ void PCA::write(FileStorage& fs ) const
fs
<<
"mean"
<<
mean
;
fs
<<
"mean"
<<
mean
;
}
}
void
PCA
::
read
(
const
FileNode
&
f
s
)
void
PCA
::
read
(
const
FileNode
&
f
n
)
{
{
CV_Assert
(
!
fs
.
empty
()
);
CV_Assert
(
!
fn
.
empty
()
);
String
name
=
(
String
)
fs
[
"name"
];
CV_Assert
(
(
String
)
fn
[
"name"
]
==
"PCA"
);
CV_Assert
(
name
==
"PCA"
);
cv
::
read
(
f
s
[
"vectors"
],
eigenvectors
);
cv
::
read
(
f
n
[
"vectors"
],
eigenvectors
);
cv
::
read
(
f
s
[
"values"
],
eigenvalues
);
cv
::
read
(
f
n
[
"values"
],
eigenvalues
);
cv
::
read
(
f
s
[
"mean"
],
mean
);
cv
::
read
(
f
n
[
"mean"
],
mean
);
}
}
template
<
typename
T
>
template
<
typename
T
>
...
...
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