필터 지우기
필터 지우기

cant display my new image

조회 수: 2 (최근 30일)
asaf omer
asaf omer 2021년 4월 10일
댓글: asaf omer 2021년 4월 10일
hello,
i have an excericse ;
i have a little pic of mozart and a big one. i seperated my big pic into 30 pieces and replaced them with the small one, now i cant show my image. can any1 help please?
a=imread('smallMozart.tiff'); # the size is 38x25
b=imread('bigMozart.tiff'); # the size is 1140x750
disp(size(b));
disp(size(a));
c=mat2cell(b,[38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38],[25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25]);
for i=1:30
for j=1:30
c{i,j}=a;
end
end
imshow(c)
thanks
  댓글 수: 1
Jan
Jan 2021년 4월 10일
편집: Jan 2021년 4월 10일
You get an error message, if you provide a cell array to the imshow command. Then it i useful to share the message with the readers. It is easier to solve a problem than to guess, what the problem is.
Why do you create c by mat2cell only to overwrite it immediately?
Avoid monsters as:
c=mat2cell(b,[38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38],[25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25]);
Easier to read:
c = mat2cell(b, repmat(38, 1, 30), repmat(25, 1, 30));
You can simplify:
for i=1:30
for j=1:30
c{i,j}=a;
end
end
to:
c(:) = {a};

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

채택된 답변

Jan
Jan 2021년 4월 10일
imshow does not accept cell arrays as input. It needs a matrix.
Either create this matrix directly:
d = repmat(a, 30, 30);
or join the cell elements:
d = cell2mat(c);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by