How to create an image from an RGB Matrix

조회 수: 4 (최근 30일)
Pavel Chatterjee
Pavel Chatterjee 2018년 3월 21일
댓글: Jan 2018년 3월 22일
I have a RGB matrix and that is very big. However I would like to create an image out of it. Can you please help?
  댓글 수: 7
Greg
Greg 2018년 3월 22일
You keep mentioning loops, what in the world are you looping?
KSSV gave the full answer, don't put any other code with it. 1584x2780x3 is not a big RGB matrix. That should display nearly instantaneously.
Jan
Jan 2018년 3월 22일
@Pavel Chatterjee: I agree with Greg: The problem is not the display of the array, but the creation. Then post the code, which takes so much time. Usually a forgotten pre-allocation is a cause for slow code, but a 1584x2780 array is not large, such that this would waste some seconds of runtime only.

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

채택된 답변

KSSV
KSSV 2018년 3월 22일
Let I be your mxnx3 RGB matrix.
imshow(I) ;
saveas(gcf,'myimage.jpg')
  댓글 수: 2
Pavel Chatterjee
Pavel Chatterjee 2018년 3월 22일
Nope! It gives me the same wait. It doesnt give an output.
Pavel Chatterjee
Pavel Chatterjee 2018년 3월 22일
Also the code gives the desired section of the image if i run lets say from row=1:100 and col=1:100.... But if I run it for its entire length it runs forever. Kept it overnight as well to check, no output

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by