How can i paint some pixels in grayscale image to non-gray colors?

조회 수: 2 (최근 30일)
Tzvi
Tzvi 2012년 12월 11일
댓글: Walter Roberson 2018년 4월 7일
I have a Grayscale images I want to paint some pixels pixels that i choose in red for example. How can i do it?

채택된 답변

Walter Roberson
Walter Roberson 2012년 12월 11일
You cannot paint some pixels a non-gray color but have it remain a grayscale image.
You can overlay a different image on top that is transparent except where you want the colored pixels, and have the color in that second image. The color would have to be specified as RGB.
You can convert the image from grayscale to RGB and then replace pixels in the new image. For example,
RGBimage = cat(3, GrayImage, GrayImage, GrayImage);
RGBimage(1:10, 1:10, 1) = 255;
RGBimage(1:10, 1:10, 2:3) = 0;
and then display RGBimage
  댓글 수: 2
David
David 2018년 4월 5일
I am using MRI data and need to highlight portions. Using cat completely distorted the image. Do you have another suggestion in how to fix this?
Walter Roberson
Walter Roberson 2018년 4월 7일
I speculate that your MRI data is grayscale 3D, with the third dimension representing slices.
How are you displaying the data?

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by