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
9db42aca
Commit
9db42aca
authored
Aug 05, 2012
by
Philipp Wagner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #2232: Bugfixes for 64bit Python-compability.
parent
064d022a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
19 deletions
+18
-19
contrib.hpp
modules/contrib/include/opencv2/contrib/contrib.hpp
+3
-14
facerec.cpp
modules/contrib/src/facerec.cpp
+5
-2
lda.cpp
modules/contrib/src/lda.cpp
+10
-3
No files found.
modules/contrib/include/opencv2/contrib/contrib.hpp
View file @
9db42aca
...
...
@@ -861,18 +861,7 @@ namespace cv
// Optimization Criterion on given data in src and corresponding labels
// in labels. If 0 (or less) number of components are given, they are
// automatically determined for given data in computation.
LDA
(
const
Mat
&
src
,
vector
<
int
>
labels
,
int
num_components
=
0
)
:
_num_components
(
num_components
)
{
this
->
compute
(
src
,
labels
);
//! compute eigenvectors and eigenvalues
}
// Initializes and performs a Discriminant Analysis with Fisher's
// Optimization Criterion on given data in src and corresponding labels
// in labels. If 0 (or less) number of components are given, they are
// automatically determined for given data in computation.
LDA
(
InputArray
src
,
InputArray
labels
,
LDA
(
InputArrayOfArrays
src
,
InputArray
labels
,
int
num_components
=
0
)
:
_num_components
(
num_components
)
{
...
...
@@ -895,7 +884,7 @@ namespace cv
~
LDA
()
{}
//! Compute the discriminants for data in src and labels.
void
compute
(
InputArray
src
,
InputArray
labels
);
void
compute
(
InputArray
OfArrays
src
,
InputArray
labels
);
// Projects samples into the LDA subspace.
Mat
project
(
InputArray
src
);
...
...
@@ -915,7 +904,7 @@ namespace cv
Mat
_eigenvectors
;
Mat
_eigenvalues
;
void
lda
(
InputArray
src
,
InputArray
labels
);
void
lda
(
InputArray
OfArrays
src
,
InputArray
labels
);
};
class
CV_EXPORTS_W
FaceRecognizer
:
public
Algorithm
...
...
modules/contrib/src/facerec.cpp
View file @
9db42aca
...
...
@@ -464,9 +464,12 @@ void Fisherfaces::train(InputArrayOfArrays src, InputArray _lbls) {
// clear existing model data
_labels
.
release
();
_projections
.
clear
();
//
get the number of unique classes (provide a cv::Mat overloaded version?)
//
safely copy from cv::Mat to std::vector
vector
<
int
>
ll
;
labels
.
copyTo
(
ll
);
for
(
unsigned
int
i
=
0
;
i
<
labels
.
total
();
i
++
)
{
ll
.
push_back
(
labels
.
at
<
int
>
(
i
));
}
// get the number of unique classes
int
C
=
(
int
)
remove_dups
(
ll
).
size
();
// clip number of components to be a valid number
if
((
_num_components
<=
0
)
||
(
_num_components
>
(
C
-
1
)))
...
...
modules/contrib/src/lda.cpp
View file @
9db42aca
...
...
@@ -975,10 +975,17 @@ void LDA::load(const FileStorage& fs) {
fs
[
"eigenvectors"
]
>>
_eigenvectors
;
}
void
LDA
::
lda
(
InputArray
_src
,
InputArray
_lbls
)
{
void
LDA
::
lda
(
InputArray
OfArrays
_src
,
InputArray
_lbls
)
{
// get data
Mat
src
=
_src
.
getMat
();
vector
<
int
>
labels
=
_lbls
.
getMat
();
vector
<
int
>
labels
;
// safely copy the labels
{
Mat
tmp
=
_lbls
.
getMat
();
for
(
unsigned
int
i
=
0
;
i
<
tmp
.
total
();
i
++
)
{
labels
.
push_back
(
tmp
.
at
<
int
>
(
i
));
}
}
// turn into row sampled matrix
Mat
data
;
// ensure working matrix is double precision
...
...
@@ -1078,7 +1085,7 @@ void LDA::lda(InputArray _src, InputArray _lbls) {
_eigenvectors
=
Mat
(
_eigenvectors
,
Range
::
all
(),
Range
(
0
,
_num_components
));
}
void
LDA
::
compute
(
InputArray
_src
,
InputArray
_lbls
)
{
void
LDA
::
compute
(
InputArray
OfArrays
_src
,
InputArray
_lbls
)
{
switch
(
_src
.
kind
())
{
case
_InputArray
:
:
STD_VECTOR_MAT
:
lda
(
asRowMatrix
(
_src
,
CV_64FC1
),
_lbls
);
...
...
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