% setUpCmatscii - Function to setup character databsase for Chinese ascii art % a calling function that runs % - countgrid.m % - characterise.m % - makeLookUp.m % % Usage: % grayLookUp=setUpCmatscii(textpic,textSpaceSizeWH,oldGLU) % % Arguments: % textpic - 2D array of image containing chinese characters % the characters must be arranged in grid % % [Optional] % textSpaceSizeWH - text width and height in pixel (if 1 element) % - [textWidth textHeight] (if 2 elements) % - [textWidth textHeight HSpace VSpace] (if 4 elements) % - if not supplied, all four parameters will be estimated % % oldGLU - exisiting grayLookUp table, new data to be added in % % Output: % grayLookUp - look up table from grayvalue to characters % grayLookUp{n} has characters of intensity = (n-1), n=[1:256] % grayLookUp{257} = I, sorted available intensity values % grayLookUp{258} = table, picture of chars arranged according to intensity % grayLookUp{259} = textWidthHeight % grayLookUp{260} = numCharTotal; % % Author: % Tzu Yen Wong % wongt AT csse DOT uwa DOT edu DOT au % Department of Computer Science & Software Engineering % The University of Western Australia % % Mar 2004 %1234567890123456789012345678901234567890123456789012345678901234567890123456789 function grayLookUp=setUpCmatscii(textpic,textSpaceSizeWH,oldGLU) eval('oldGLU;','oldGLU={};'); eval('textSpaceSizeWH;','textSpaceSizeWH=[];') [textpic,estimation]=countgrid(textpic,textSpaceSizeWH); [data,intensity,textWdHgt]=characterise(textpic,estimation); %grayLookUp = makeLookUp(data,intensity,textWdHgt,oldGLU,showChar); grayLookUp = makeLookUp(data,intensity,textWdHgt,oldGLU,0);