how to delete the white pixel(255) from grey scale image

1 vue (au cours des 30 derniers jours)
saravanakumar D
saravanakumar D le 29 Déc 2013
Commenté : Image Analyst le 29 Déc 2013
I have to delete only 225 value white pixel from gray scale image. But i don't know how to identified each pixel from image and check if it is 255 and assign it's value to zero. Please help me

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 29 Déc 2013
Modifié(e) : Azzi Abdelmalek le 29 Déc 2013
  11 commentaires
saravanakumar D
saravanakumar D le 29 Déc 2013
This is my program. It has major error, which i don't know.If i run this program matlab stop working.
function W = Classify(ImageRead) % Step 1: Read image Read in RGB = imread('E:\Working\mapping\first\map.png'); figure, imshow(RGB), title('Original Image');
% Step 2: Convert image from rgb to gray GRAY = rgb2gray(RGB); g=GRAY; imtool(GRAY); title('Gray Image');
[r c]=size(g); hold on for i=1:r for j=1:c if (impixel(g,j,i)>254)
GRAY(i,j)=0;
end
end
end
hold off
imtool(GRAY);
Image Analyst
Image Analyst le 29 Déc 2013
Why do you have both g and GRAY? You don't need two. And we're back to Azzi's original answer
g(g==255)=0;
GRAY(GRAY==255)=0;
Why didn't you follow his advice instead of doing things with for loops and two copies of the same image?

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Image Processing Toolbox dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by