%SYMBOLLIBRARY01GENIMAGE % % [IMG] = SYMBOLLIBRARY01GENIMAGE(P,IND) Generates image number % IND (size 160x160) of the symbol library found in path % P. Symbol library contains images of electronic components. See % ICPR'99 for more information of the library. % % [IMG] = SYMBOLLIBRARY01GENIMAGE(P,IND, ALPHA, BETA, GAMMA) % generates image with noise values alpha, beta and gamma. % % NOTE: WARNING AND ERROR MESSAGES OF THE EXECUTABLES ARE % ELIMINATED AND THUS YOU MUST DEBUG THIS M-FILE IF SOMETHING IS % NOT WORKING!! % % Matlab wrapper for the corresponding executable 'genimage' % function [img] = symbollibrary01genimage(p_, ind_, varargin); if (nargin > 2) % user wants some noise in image currpath = pwd; % this must be done because genimage executable is stupid cd([p_ '/code']); [s,w] = unix(['./genimage /tmp tmpimg ' num2str(ind_) ' 6.4 10 1 1']); cd(currpath); alpha = varargin{1}; beta = varargin{2}; gamma = varargin{3}; [s,w] = unix([p_ '/softwares/addnoise/addbnoise -I /tmp/tmpimg.tiff' ... ' -O /tmp/tmpimgnoise.tiff ' ... ' -a ' num2str(alpha) ' -A ' num2str(alpha) ... ' -d ' num2str(beta) ' -D ' num2str(beta) ... ' -r ' num2str(gamma) ' -R ' num2str(gamma)]); % convert to format that the matlab can read [s,w] = unix(['convert /tmp/tmpimgnoise.tiff /tmp/tmpimgnoise.bmp']); img = imread('/tmp/tmpimgnoise.bmp'); else % user wants just a base image without rotation or noise currpath = pwd; % this must be done because genimage executable is stupid cd([p_ '/code']); [s,w] = unix(['./genimage /tmp tmpimg ' num2str(ind_) ' 6.4 0.0 1 1']); cd(currpath); % convert to format that the matlab can read [s,w] = unix(['convert /tmp/tmpimg.tiff /tmp/tmpimg.bmp']); img = imread('/tmp/tmpimg.bmp'); end;