how to eliminate white pixels(smoke pixels) in the rgb image

4 ビュー (過去 30 日間)
senthil vadivu
senthil vadivu 2016 年 12 月 8 日
回答済み: Gautam 2024 年 10 月 24 日
how to eliminate white pixels(smoke pixels) in the rgb image
  1 件のコメント
KSSV
KSSV 2016 年 12 月 8 日
eliminate in the sense? You want to replace that with something else?

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

回答 (1 件)

Gautam
Gautam 2024 年 10 月 24 日
You can eliminate white pixels from an RGB image by identifying these pixels and then replacing them with a suitable value, such as the background color or making them transparent. This can be done in two steps
  1. Identify White Pixels: Define a threshold to identify white pixels based on their RGB values.
  2. Replace White Pixels: Replace these identified pixels with another color or make them transparent.
img = imread(image);
whiteThreshold = 240;
% Create a mask for white pixels
whiteMask = img(:,:,1) > whiteThreshold & img(:,:,2) > whiteThreshold & img(:,:,3) > whiteThreshold;
%Replace white pixels with black (or any other color)
replacementColor = [0, 0, 0];
img(repmat(whiteMask, [1, 1, 3])) = repmat(reshape(replacementColor, [1, 1, 3]), sum(whiteMask(:)), 1);

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by