Skip to content

Instantly share code, notes, and snippets.

@jamie23
Last active December 30, 2015 06:19
Show Gist options
  • Save jamie23/7788857 to your computer and use it in GitHub Desktop.
Save jamie23/7788857 to your computer and use it in GitHub Desktop.
function getImages()
%Puts images into matrices
% randomise weights
% Until total error < (0.1?) or you can do it until the validation set has a low error
% repeat for each letter
% apply first letter
% calculate error and make positive
% add first letter to total error
% change weight
%repeat
%repeat
%read in images
%send to file
%dlmwrite('\\TOWER9\home50\b0076834\MATLAB\output',C);
cellArray = cell(1,44);
for j=1:9
A = imread(strcat('\\TOWER9\home50\b0076834\Downloads\EnglishHndD\EnglishHndD\Img\Sample001\img001-00',num2str(j),'.png'));
B = imresize(A, [20 20],'nearest');
C = im2double(B);
cellArray{j} = C;
cellArray{j};
%Proves it's working
dlmwrite(strcat('\\TOWER9\home50\b0076834\MATLAB\output',num2str(j)),cellArray{j});
end
%Instead of a conditional checking, it's more efficient to have another
%loop
for j=10:44
A = imread(strcat('\\TOWER9\home50\b0076834\Downloads\EnglishHndD\EnglishHndD\Img\Sample001\img001-0',num2str(j),'.png'));
B = imresize(A, 0.5);
C = im2double(B);
% cellArray{j} = C;
end
%Need to split up
%Target = 000000001, 1 | 0000000010, 2 | 0000000100, 3 | etc.
%set up targets, run for total amount of images
cellTargets = zeros(10,550);
x = 1;
for j = 1:550
if mod(j,55) == 0
x = x+1;
end
cellTargets(x,j) = 1;
end
%Read in images
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment