Skip to content
Browse files

printf switched to MATLAB-compatible fprintf.

  • Loading branch information...
1 parent afef063 commit ddab88787de4f32e99436b4c2796a99e85bcf063 @bytefish committed May 2, 2012
View
5 m/fisherfaces_example.m
@@ -2,7 +2,7 @@
addpath (genpath ('.'));
% load data
-[X y width height names] = read_images('/home/philipp/facerec/data/yalefaces_recognition');
+[X y width height names] = read_images('/home/philipp/facerec/data/at');
% compute a model
fisherface = fisherfaces(X,y);
@@ -26,7 +26,8 @@
%% 3D plot of projection (first three classes)
figure; hold on;
for i = findclasses(fisherface.y, [1,2,3])
- plot3(fisherface.P(1,i), fisherface.P(2,i), fisherface.P(3,i), 'r.');
+ % LineSpec: red dots 'r.'
+ plot3(fisherface.P(1,i), fisherface.P(2,i), fisherface.P(3,i), 'r.'), view(45,-45);
text(fisherface.P(1,i), fisherface.P(2,i), fisherface.P(3,i), num2str(fisherface.y(i)));
end
View
2 m/prediction_example.m
@@ -18,4 +18,4 @@
% get a prediction from the model
predicted = fisherfaces_predict(model, Xtest, 1);
% only for debug
-printf('predicted=%d,actual=%d\n', predicted, ytest)
+fprintf(1,'predicted=%d,actual=%d\n', predicted, ytest)
View
2 m/util/read_image.m
@@ -10,6 +10,6 @@
X = reshape(X,width*height,1);
catch
lerr = lasterror;
- printf('Cannot read image %s.\nReason:\n%s\n', filename, lerr);
+ fprintf(1,'Cannot read image %s.\nReason:\n%s\n', filename, lerr);
end
end
View
4 m/util/read_images.m
@@ -41,7 +41,7 @@
T = double(imread(filename));
catch
lerr = lasterror;
- printf('Cannot read image %s', filename)
+ fprintf(1,'Cannot read image %s', filename)
end
[height width channels] = size(T);
@@ -58,7 +58,7 @@
added = added + 1;
catch
lerr = lasterror;
- printf('Image cannot be added to the Array. Wrong image size?\n')
+ fprintf(1,'Image cannot be added to the Array. Wrong image size?\n')
end
end
% only increment class if images were actually added!
View
2 m/validation/KFoldCV.m
@@ -74,7 +74,7 @@
% classN|ABBBBBBBBB| classN|BABBBBBBBB|
%
if(print_debug)
- printf('Processing fold %d.\n', i);
+ fprintf(1,'Processing fold %d.\n', i);
if isoctave()
fflush(stdout);
end
View
2 m/validation/LeaveOneClassOutCV.m
@@ -23,7 +23,7 @@
C = max(y); % y must be {1,2,3,...,C}
for i = 1:C
if(print_debug)
- printf('Processing class %d/%d.\n',i,C);
+ fprintf(1,'Processing class %d/%d.\n',i,C);
if isoctave()
fflush(stdout);
end
View
2 m/validation/LeaveOneOutCV.m
@@ -17,7 +17,7 @@
n = length(y);
for i = 1:n
if(print_debug)
- printf('Processing fold %d/%d.\n', i, n);
+ fprintf(1,'Processing fold %d/%d.\n', i, n);
if isoctave()
fflush(stdout);
end
View
4 m/validation_example.m
@@ -12,7 +12,7 @@
cv1 = KFoldCV(X,y,10,eigenfaces_train, eigenfaces_test, 0, 1);
% tpr = tp / (tp+fp)
tpr_eigenfaces = cv1(1)/(cv1(1)+cv1(2));
-printf('TPR_{Eigenfaces}=%.2f%%\n', tpr_eigenfaces*100.0);
+fprintf(1,'TPR_{Eigenfaces}=%.2f%%\n', tpr_eigenfaces*100.0);
% Learn the Fisherfaces (no parameters needed)
fisherfaces_train = @(X,y) fisherfaces(X,y);
@@ -21,4 +21,4 @@
% a 10-fold cross validation (per fold=0, debug=1)
cv2 = KFoldCV(X,y,10, fisherfaces_train, fisherfaces_test, 0, 1);
tpr_fisherfaces = cv2(1)/(cv2(1)+cv2(2));
-printf('TPR_{Fisherfaces}=%.2f%%\n', tpr_fisherfaces*100.0);
+fprintf(1,'TPR_{Fisherfaces}=%.2f%%\n', tpr_fisherfaces*100.0);

0 comments on commit ddab887

Please sign in to comment.
Something went wrong with that request. Please try again.