Removing grey pixels from an image

2 ビュー (過去 30 日間)
Tarik Razak
Tarik Razak 2012 年 2 月 7 日
編集済み: Walter Roberson 2013 年 10 月 3 日
Hi I have an image in which there are black pixels and gray ones. I am trying a way to remove the gray pixels and just keep the black ones. I dont want to do im2bw because I believe it will just turn the gray to black. Thanks for the help
  2 件のコメント
Walter Roberson
Walter Roberson 2012 年 2 月 7 日
What should the gray pixels be replaced with?
Tarik Razak
Tarik Razak 2012 年 2 月 7 日
with white or nothing thanks

サインインしてコメントする。

回答 (2 件)

Image Analyst
Image Analyst 2012 年 2 月 7 日
You can't replace with nothing because the image must remain rectangular. So try this
imageArray(imageArray ~= 0) = 255;
That will turn all pixels not equal to zero (pure black) to 255 (pure white). If you need 1 instead of 255 (like it's a logical or floating point image) then just use 1 instead of 255.
imageArray(imageArray ~= 0) = 1;

Shiva Arun Kumar
Shiva Arun Kumar 2012 年 2 月 7 日
Why would this not work?
bw=im2bw(I,0)
Where I is the image that was read in.

カテゴリ

Help Center および File ExchangeModify Image Colors についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by