-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
99 additions
and
99 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
faceClass = 20; | ||
number = 10; | ||
|
||
path = '../facedata/DB/jpeg/' | ||
|
||
for i=1:faceClass | ||
for j=1:number | ||
str = strcat(path,num2str(number*(i-1)+j-1, '%03d'),'.jpg'); | ||
img = imread(str); | ||
DB(:,:,number*(i-1)+j) = img; | ||
end | ||
end |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
function number = matching(DB, X) | ||
dblX = double(X); | ||
for i=1:200 | ||
A = DB(:,:,i); | ||
dblA = double(A); | ||
D = (dblX - dblA).^2; | ||
distance(i) = sum(sum(D)); | ||
end | ||
[minimum, index] = min(distance); | ||
number = ceil(index/10); | ||
% sprintf('X is Person %d.',number) | ||
end |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,39 @@ | ||
faceClass = 20; | ||
number = 10; | ||
% MATLAB上にDBを実装するためのスクリプトMファイル | ||
clc | ||
clear | ||
c = 20; % クラス総数 | ||
n = 10; % 1クラス当たりの学習パターン数 | ||
|
||
path = '../facedata/DB/jpeg/' | ||
% DBの画像ファイル場所 | ||
path = 'M:\project\dataset2\DB\jpeg\'; | ||
|
||
for i=1:faceClass | ||
for j=1:number | ||
str = strcat(path,num2str(number*(i-1)+j-1, '%03d'),'.jpg'); | ||
img = imread(str); | ||
DB(:,:,number*(i-1)+j) = img; | ||
end | ||
%H = fspecial('disk', 20); %フィルターの作成(ぼかし) | ||
for i=1:c | ||
for j=1:n | ||
str = strcat(path, num2str(n*(i-1)+j-1, '%03d'), '.jpg'); | ||
img = imread(str); | ||
|
||
%img = edge(img, 'Canny'); | ||
%img = imfilter(img, H, 'replicate'); | ||
|
||
DB(:,:,n*(i-1)+j) = img; % 3次元配列の場合 | ||
end | ||
end | ||
|
||
%% クエリのDB | ||
%クエリDBの画像場所 | ||
Qpath = 'M:\project\dataset2\Query\jpeg\*.jpg'; | ||
path = 'M:\project\dataset2\Query\jpeg\'; | ||
|
||
%Qpathの中身 | ||
D = dir(Qpath); | ||
|
||
for i=1:length(D) | ||
name = strcat(path, D(i).name); | ||
img = imread(name); | ||
|
||
%img = edge(img, 'Canny'); | ||
%img = imfilter(img, H, 'replicate'); | ||
|
||
Query(:,:,i) = img; | ||
end |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,18 @@ | ||
function number = matching(DB, X) | ||
dblX = double(X); | ||
for i=1:200 | ||
A = DB(:,:,i); | ||
dblA = double(A); | ||
D = (dblX - dblA).^2; | ||
distance(i) = sum(sum(D)); | ||
end | ||
[minimum, index] = min(distance); | ||
number = ceil(index/10); | ||
% sprintf('X is Person %d.',number) | ||
function number = matching(DB,Query,q) | ||
%単純マッチング関数(関数Mファイル) | ||
%クエリ画像XとDBの画像をピクセル毎に比較し、二乗誤差が最も小さい人物を出力する | ||
X = Query(:,:,q); | ||
dblX = double(X); | ||
for i=1:200 | ||
A = DB(:,:,i); | ||
dblA = double(A); | ||
D = (dblX-dblA).^2; | ||
distance(i) = sum(sum(D)); | ||
end | ||
|
||
[minimum, index] = min(distance); | ||
|
||
number = ceil(index/10)-1; | ||
%sprintf('X is Person %d.',number) | ||
end | ||
|
File renamed without changes.
File renamed without changes.