getTileimage()
MATLABで指定画像のタイルイメージを作る.
function dst = getTileimage ( src, imageHeight, imageWidth ) %getTileimage srcをサイズimageHeight, imageWidthに対応する様並べた画像を出力する %% Initialize % 並べる画像のサイズを得る [srcHeight, srcWidth] = size(src); %% Preprocess % 画像を連結する個数を明らかにする if( mod(imageHeight, srcHeight) ) hCat = floor(imageHeight/srcHeight) + 1; else hCat = floor(imageHeight/srcHeight); end if( mod(imageWidth, srcWidth) ) wCat = floor(imageWidth/srcWidth) + 1; else wCat = floor(imageWidth/srcWidth); end %% Main processing % 前処理で決めた数だけ画像をタイルする dst = repmat(src, hCat, wCat); %% Post-processing % 指定されたサイズに切り出す dst = dst(1:imageHeight, 1:imageWidth); end