is it possible to convert binary image to rgb image or i want to replace all pixel values 0 by some red or green color in new image?

is it possible to convert binary image to rgb image or i want to replace all pixel values 0 by some red or green color in new image using matlab code?

 채택된 답변

How about
image=repmat(double(image),[1,1,3]);
this way you have a matrix with 3 dimensions. image(:,:,1)is the red channel, image(:,:,2) the green one and image(:,:,3) is blue. Now you could set the channels according to your needs.
Hope this helps

댓글 수: 4

sir its not working sir. can u check it..i m getting the following error.
Error in ==> imageDisplayParseInputs at 79
common_args = imageDisplayValidateParams(common_args);
Error in ==> imshow at 199
[common_args,specific_args] = ...
If you have not checked if an naswer works for you, you should not accept it.
Now can you show the imshow command that you used?
Oh and you might want to make sure the values of your image are all in the range 0:1, if I'm not wrong you might get strange behaviour when saving your image otherwise.
@Somasekar: Please post the complete error message. It seems like all important information is missing.
@Somasekar: Also it would be nice if you wouldn't post multiple questions with the same or nearly the same content. Thanks

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

추가 답변 (0개)

카테고리

도움말 센터File 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