Image tiling & combining images

조회 수: 4 (최근 30일)
Sam
Sam 2013년 2월 7일
Hello. Quite new to the MATLAB, trying to make an image with 4 different images, where each side(upperwest,uppereast,lowereast,lowerwest)is a different image. Like one of those Andy Warhol photographs. But I keep getting this error when I try to run the function:
>> imshow(TileImage(image1,image2,image3,image4))
Subscripted assignment dimension mismatch.
Error in TileImage (line 16)
NewImage(1:floor(end/2),floor(end/2)+1:end,:) =
image2(:,:,:);
Here is my function:
*function [ NewImage ] = TileImage( image1,image2,image3,image4 )
%TileImage takes an input for an array of four tiled image.
% TileImage is an RGB matrix made out of four input image matrices.____
rows = size(image1, 1);
columns = size(image1, 2);
layers = size(image1, 3);
% A matrix to make the image into a matrix of zeros to make all images
% equally sized.
NewImage = uint8(zeros(2.*rows,2.*columns,layers));
% To make all images the same size and place them into a specific
% quadrant.
NewImage(1:floor(end/2),1:floor(end/2),:) = image1(:,:,:);
NewImage(1:floor(end/2),floor(end/2)+1:end,:) = image2(:,:,:);
NewImage(floor(end/2)+1:end,1:floor(end/2),:) = image3(:,:,:);
NewImage(floor(end/2)+1:end,floor(end/2)+1:end,:) = image4(:,:,:);
end*
Am I missing something? Maybe in the command window? All 4 images are already defined in CW. Any help will be much appreciated!!

채택된 답변

Walter Roberson
Walter Roberson 2013년 2월 7일
Like I told you before, here, one of your images is not the same size as one of the others. From the error message, I can tell that image2 is not the same size as image1.
  댓글 수: 1
Sam
Sam 2013년 2월 7일
Thank You. I completly forgot to go back to your answer last night as I was extremely tired. Sorry for the repetition.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by