Starting with a grayscale image, how can I colour a certain pixel based on its x,y coordinates?

조회 수: 18 (최근 30일)
I have a 256 by 256 grayscale image. I want to colour a certain coordinating (say 125,125) red. Do I need to convert the entire image into truecolour? I want to keep the greyscale image how it was other than the coloured pixel. Would gray2ind seems like the appropiate first step, but I'm not sure how to go from there.
Thanks in advanced!
  댓글 수: 2
John BG
John BG 2017년 6월 29일
you don't have to convert the image to true color, but you can if the only code available you use can only work in one specific image format. Changing image format is easy in MATLAB.
Would you please supply a sample image so readers can show you different ways to alter single pixels.
Naim
Naim 2017년 6월 29일
Hey John thanks for your reply. I just want to add a colour pixel for testing purposes really. I didn't include a picture because the grayscale image I am using is irrelevant (I want to change specific pixels based on coordinates) but I went ahead and attached a photo anyway. Could you elaborate on how I could add the colour pixel to my grayscale photo? I'd appreciate the help!

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

답변 (1개)

Swarooph
Swarooph 2017년 6월 29일
편집: Swarooph 2017년 6월 29일
Take a look at the question and answer here.
Note that grayscale images cannot have color pixels by definition. If you are just interested in marking a pixel with a marker you can use the plot function as discussed in the above answer's comments or use the insertMarker function.

카테고리

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