2011-02-25 4 views

답변

2

한 가지 방법은 이미지가 포함 된 10x10 셀 배열을 만든 다음 CELL2MAT을 사용하여 이미지를 큰 이미지로 연결하는 것입니다.

nRows = 10; 
nCols = 10; 
imgCell = cell(nRows,nCols); 

for iImage = 1:nRows*nCols 

%# construct image name - fix this like so it conforms to your naming scheme 
%# also, add the path if necessary 
imageName = sprintf('image%i.jpg',iImage); 

%# add the image to imgCell 
%# images will filled first into all rows of column one 
%# then into all rows of column 2, etc 
imgCell{iImage} = imread(imageName); 

end 

%# if you want the images to be arranged along rows instead of 
%# columns, you can transpose imgCell here 
%# imgCell = imgCell'; 

%# catenate into big image 
bigImage = cell2mat(imgCell); 

%# show the result 
imshow(bigImage) 
+0

안녕하세요 조나스, 답변 해 주셔서 감사합니다. 귀하의 코딩은 이미지가 한 행 또는 한 열에 연결될 큰 이미지를 만듭니다. 내가 원했던 것은 처음 10 개의 이미지가 큰 결과 이미지의 첫 번째 행에 연결되어야한다는 것입니다. 다음 10 행은 두 번째 행과 같이 10 행을 완료합니다. 이미지의 크기가 400x400 인 경우 결과 이미지는 4000x4000입니다. 400x40000이 아닙니다. 내가 더 일찍 알려지지 않았다면 미안해. – Shan

+1

@Shan : 모든 코드를 실행하는 경우 즉, imgCell을 제대로 초기화하면 코드에서 400 x 400의 이미지가 100 개있는 경우 내 코드가 4k x 4k의 이미지를 만들어야합니다. – Jonas

+0

@Jonas ... 네, 작동합니다 .. 많이 고마워요. – Shan

관련 문제