필터 지우기
필터 지우기

matlab image processing

조회 수: 2 (최근 30일)
parul
parul 2012년 3월 24일
댓글: Omkar Bhanap 2018년 2월 21일
How to merge the r,g and b components to get a single rgb image in matlab???

채택된 답변

Jan
Jan 2012년 3월 24일
r = rand(20, 30);
g = rand(20, 30);
b = rand(20, 30);
rgb = cat(3, r, g, b);
  댓글 수: 2
parul
parul 2012년 3월 27일
Actually the thing is that we have r an b components of same dimension i.e. 148*114*3 but the g component is having 148*114 dimension.So,if we are adjusting its dimension,and then merging using the "cat" command,then we are getting a complete gray image.What to do in this case??
Omkar Bhanap
Omkar Bhanap 2018년 2월 21일
Is this command suitable for code generation purpose ??

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

추가 답변 (2개)

Sivakumaran Chandrasekaran
Sivakumaran Chandrasekaran 2012년 3월 24일
hi jan, r = rand(20, 30); g = rand(20, 30); b = rand(20, 30); rgb = [r, g, b]; imshow(rgb)
thats my code.. could you explain me whats the different between your code and mine. I am getting gray image as output. But,you are getting colored one. could you explain this technically. why i am not getting color image even though i concatenated those three basic colors.
Regards, Siva
  댓글 수: 2
Bjorn Gustavsson
Bjorn Gustavsson 2012년 3월 24일
If you get pure gray it might be because your R G and B images are identical or close to identical?
Jan
Jan 2012년 3월 24일
[r,g,b] is equivalent to cat(2, r, g, b): It concatenates along the 2nd dimension. Try it with smaller values to keep the overview:
r=[1,2;3,4]; g=r+5; b=g+5;
disp([r,g,b])
disp(cat(3, r, g, b))
The concatenation along the 2nd dimension creates a 2D matrix of type double, which is displayed as grey scale image.

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


Sivakumaran Chandrasekaran
Sivakumaran Chandrasekaran 2012년 3월 27일
Thanks Jan and Bjorn

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by