How can i set few pixels to a particular color(red) in a gray scale image?

2 ビュー (過去 30 日間)
Nithya
Nithya 2014 年 2 月 1 日
コメント済み: Nithya 2014 年 3 月 14 日
The image is gray scale.If i can get a condition to select some pixels, (say for all x>100 or anything), I want those selected pixels to be of red color when i display the image. Condition doesnt matter because i have the pixel coordinates for which i want red color.Please help me with some ideas. Thankyou.

回答 (1 件)

Shivaputra Narke
Shivaputra Narke 2014 年 2 月 1 日
May be this is what you want.. close all; clear all;
a=imread('cameraman.tif');
%%% condition to find pixel location pxllocat=find(a>128);
[X, map] = gray2ind(a,255); % 255 is for 8 bit image
getLocationInMap=unique(X(pxllocat)); for i=1:length(getLocationInMap) map(i,:)=[1 0 0]; end figure;imshow(a);title('Original Image'); figure;imshow(X,map);title('Modified Image');

カテゴリ

Help Center および File ExchangeGet Started with Image Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by