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
86524b0e
Commit
86524b0e
authored
May 05, 2012
by
Philipp Wagner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed facerec_demo.cpp.
parent
70f74b70
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
facerec_demo.cpp
samples/cpp/facerec_demo.cpp
+14
-3
No files found.
samples/cpp/facerec_demo.cpp
View file @
86524b0e
...
...
@@ -25,6 +25,17 @@
using
namespace
cv
;
using
namespace
std
;
Mat
toGrayscale
(
InputArray
_src
)
{
Mat
src
=
_src
.
getMat
();
// only allow one channel
if
(
src
.
channels
()
!=
1
)
CV_Error
(
CV_StsBadArg
,
"Only Matrices with one channel are supported"
);
// create and return normalized image
Mat
dst
;
cv
::
normalize
(
_src
,
dst
,
0
,
255
,
NORM_MINMAX
,
CV_8UC1
);
return
dst
;
}
void
read_csv
(
const
string
&
filename
,
vector
<
Mat
>&
images
,
vector
<
int
>&
labels
,
char
separator
=
';'
)
{
std
::
ifstream
file
(
filename
.
c_str
(),
ifstream
::
in
);
if
(
!
file
)
...
...
@@ -79,10 +90,10 @@ int main(int argc, const char *argv[]) {
for
(
int
i
=
0
;
i
<
min
(
10
,
W
.
cols
);
i
++
)
{
// get eigenvector #i
Mat
ev
=
W
.
col
(
i
).
clone
();
// reshape to original site
Mat
grayscale
,
cgrayscale
;
cvtColor
(
ev
.
reshape
(
1
,
height
),
grayscale
,
COLOR_BGR2GRAY
);
// reshape to original size AND normalize between [0...255]
Mat
grayscale
=
toGrayscale
(
ev
.
reshape
(
1
,
height
));
// show image (with Jet colormap)
Mat
cgrayscale
;
applyColorMap
(
grayscale
,
cgrayscale
,
COLORMAP_JET
);
imshow
(
format
(
"%d"
,
i
),
cgrayscale
);
}
...
...
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