Skip to content

Instantly share code, notes, and snippets.

@Mizzlr
Last active June 29, 2016 11:20
Show Gist options
  • Save Mizzlr/0729ee600f30a8439feb21702a38fcdd to your computer and use it in GitHub Desktop.
Save Mizzlr/0729ee600f30a8439feb21702a38fcdd to your computer and use it in GitHub Desktop.
X = []
numImages = 0
for num=1:1000 % upto 1000 fonts; increase if needed
filename = strcat('dataset/',strcat(num2str(num),'.png'));
if ~exist(filename,'file')
continue
end
disp(filename);
image = imread(filename);
for i=1:5
for j=1:19
k = (i - 1) * 30 + 1;
l = (j - 1) * 30 + 1;
X1 = reshape(image(k + 3:k + 32 , l : l + 29 , 1),1,900);
X = [X ; X1];
end
end
X = X(1:end - 3, :);
numImages ++;
end
Y = repmat([1:92]',numImages,1);
dlmwrite('X.csv',X)
dlmwrite('Y.csv',Y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment