Removing grey pixels from an image
조회 수: 1 (최근 30일)
이전 댓글 표시
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
답변 (2개)
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;
댓글 수: 0
Shiva Arun Kumar
2012년 2월 7일
Why would this not work?
bw=im2bw(I,0)
Where I is the image that was read in.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Modify Image Colors에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!