Omitting negative pixels in the image representation

Say that I have an image where there are some pixels which values are negative. How can I omit those from the image representation in `MATLAB`?
Thanks.

1 件のコメント

Image Analyst
Image Analyst 2014 年 2 月 16 日
What's going on? You already had a discussion on this going in http://www.mathworks.com/matlabcentral/answers/116236#comment_196593 and then you posted the same thing twice more. I deleted the version that no one has answered yet. Why would you want to look for answers in three separate threads?????

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

回答 (1 件)

Wayne King
Wayne King 2014 年 2 月 16 日

0 投票

Depending on your data and application, you can just take the absolute value. If that doesn't work you can set all the negative values to zero using logical indexing
X = randn(256);
X(X<0) = 0;

4 件のコメント

med-sweng
med-sweng 2014 年 2 月 16 日
@Wayne. Thanks for your reply. So, does giving pixels the value `0` means we are omitting them? And, does that also have the same meaning as `removing` them?
Wayne King
Wayne King 2014 年 2 月 16 日
not sure how you want to remove them, removing them from what? analysis, display?
med-sweng
med-sweng 2014 年 2 月 18 日
Removing them from the display
Image Analyst
Image Analyst 2014 年 2 月 18 日
Wayne already gave you code for that. Look above.

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

カテゴリ

ヘルプ センター および File ExchangeRead, Write, and Modify Image についてさらに検索

質問済み:

2014 年 2 月 16 日

コメント済み:

2014 年 2 月 18 日

Community Treasure Hunt

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

Start Hunting!

Translated by