Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MATLAB compability issues fixed.

  • Loading branch information...
commit bf588442f88856ffee809f95a0e5318832bbef96 1 parent 9ab895c
@bytefish authored
View
6 m/eigenfaces_example.m
@@ -7,8 +7,6 @@
% compute a model
eigenface = eigenfaces(X,y,100);
-%% Plots
-
% plot the first (atmost) 16 eigenfaces
figure;
title('Eigenfaces (AT&T Facedatabase)');
@@ -21,7 +19,6 @@
title(sprintf('Eigenface #%i', i));
end
-
%% 2D plot of projection (add the classes you want)
figure; hold on;
for i = findclasses(eigenface.y, [1,2,3])
@@ -31,7 +28,8 @@
%% 3D plot of projection (first three classes, add those you want)
figure; hold on;
for i = findclasses(eigenface.y, [1,2,3])
- plot3(eigenface.P(1,i), eigenface.P(2,i), eigenface.P(3,i), 'r.');
+ % LineSpec: red dots 'r.'
+ plot3(eigenface.P(1,i), eigenface.P(2,i), eigenface.P(3,i), 'r.'), view(45,-45);
text(eigenface.P(1,i), eigenface.P(2,i), eigenface.P(3,i), num2str(eigenface.y(i)));
end
View
10 m/util/isoctave.m
@@ -0,0 +1,10 @@
+function in = isoctave ()
+%% returns true if the script is running in GNU Octave (MATLAB 7.2 compatible)
+%% http://octave.1599824.n4.nabble.com/How-to-determine-if-you-are-in-octave-or-matlab-td1624960.html
+ persistent inout;
+
+ if isempty(inout),
+ inout = exist('OCTAVE_VERSION','builtin') ~= 0;
+ end;
+ in = inout;
+end
View
16 m/util/read_images.m
@@ -1,21 +1,16 @@
function [X y width height names] = read_images(path)
%% Read images from a given path and return the Imagematrix X.
%%
- %% Args:
- %% path:
- %%
%% Returns:
- %% X: Array with images given in columns -- [X1,X2,...,Xn]
- %% y: Classes corresponding to images of X. -- [y1,y2,...,yn]
- %% width: width of the images
- %% height: height of the images
- %% names: name of each class -- names{1} is the name of class 1
+ %% X [numDim x numSamples] Array with images given in columns -- [X1,X2,...,Xn]
+ %% y [1 x numSamples] Classes corresponding to images of X. -- [y1,y2,...,yn]
+ %% width [int] width of the images
+ %% height [int] height of the images
+ %% names [cell array] folder name of each class, so names{1} is the name of class 1
%%
%% Example:
%% [X y width height names] = read_images("./data/yalefaces")
%%
- %% TODO add fixed image dimension, resizing images if necessary.
- %%
folder = list_files(path);
X = [];
y = [];
@@ -65,7 +60,6 @@
lerr = lasterror;
printf('Image cannot be added to the Array. Wrong image size?\n')
end
- fflush(stdout); % show warnings (probably not necessary, doesn't harm anyway)
end
% only increment class if images were actually added!
if ~(added == 0)
View
4 m/validation/KFoldCV.m
@@ -72,7 +72,9 @@
%
if(print_debug)
printf('Processing fold %d.\n', i);
- fflush(stdout);
+ if isoctave()
+ fflush(stdout);
+ end
end
l = i*foldSize+1;
View
4 m/validation/LeaveOneClassOutCV.m
@@ -24,7 +24,9 @@
for i = 1:C
if(print_debug)
printf('Processing class %d/%d.\n',i,C);
- fflush(stdout);
+ if isoctave()
+ fflush(stdout);
+ end
end
% build indices
testIdx = find(y==i);
View
4 m/validation/LeaveOneOutCV.m
@@ -18,7 +18,9 @@
for i = 1:n
if(print_debug)
printf('Processing fold %d/%d.\n', i, n);
- fflush(stdout);
+ if isoctave()
+ fflush(stdout);
+ end
end
Xi = X(:,1); X(:,1) = [];
Please sign in to comment.
Something went wrong with that request. Please try again.