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

조회 수: 3 (최근 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 CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by