combining many RGB images into one image

조회 수: 3 (최근 30일)
Nour Mawla
Nour Mawla 2015년 5월 16일
댓글: Image Analyst 2015년 5월 17일
good after noon everyone....
I wrote this script that must combines 3 RGB images into one image note that 1.png, 2.png and 3.png are images of same dimentions (500 x 666) I need the final image to show the three images as one image but with reasonable dimensions
Rows = 1;
Cols = 3;
Cell = cell(Rows,Cols);
for i = 1:Rows*Cols
imageName = sprintf('%i.png',i);
imgCell{i} = imread(imageName);
end
bigImage = mat2cell(imgCell);
imshow(bigImage)
However I received this error:
Error using imageDisplayValidateParams
Expected input number 1, I, to be one of these types:
double, single, uint8, uint16, uint32, uint64, int8, int16, int32, int64, logical
Instead its type was cell.
Error in imageDisplayValidateParams (line 11)
validateattributes(common_args.CData, {'numeric','logical'},...
Error in imageDisplayParseInputs (line 78)
common_args = imageDisplayValidateParams(common_args);
Error in imshow (line 219)
[common_args,specific_args] = ...
Error in Untitled3 (line 26)
imshow(bigImage)

답변 (2개)

Image Analyst
Image Analyst 2015년 5월 16일
What do you want to do? Do you want to average them together? Stitch them side-by-side? Have you seen montage(), imshowpair(), and imfuse()? Explain more what you want to do and I can give a more specific solution.
  댓글 수: 4
Nour Mawla
Nour Mawla 2015년 5월 16일
ok I will try it but please can you tell me why am I receiving the error in the code i wrote? Not just in this function but whenever I try to call an image from a database it pops out
Image Analyst
Image Analyst 2015년 5월 16일
Because you're passing imshow() a cell array , and in each cell of the array is a chunk of an image - a sub image. imshow() wants the images themselves, directly, it doesn't want a cell array of a bunch of cells that each contain an image. A cell array is like a collection of buckets, and you can thrown whatever you want (images, strings, etc.) into any of the buckets. Please read the FAQ to get a good intuitive feel for what cell arrays are: http://matlab.wikia.com/wiki/FAQ#What_is_a_cell_array.3F

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


Oliver Woodford
Oliver Woodford 2015년 5월 16일
You can display a cell array of images using imdisp.
imdisp(imgCell)
  댓글 수: 2
Nour Mawla
Nour Mawla 2015년 5월 17일
i got this error Undefined function 'imdisp' for input arguments of type 'cell'.
Image Analyst
Image Analyst 2015년 5월 17일
I think you may have not visited the link he gave to his File Exchange and downloaded the file. http://www.mathworks.com/matlabcentral/fileexchange/22387-imdisp
Or if you did, you put it somewhere not on the search path.

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

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by