how to eliminate white pixels(smoke pixels) in the rgb image
5 次查看(过去 30 天)
显示 更早的评论
how to eliminate white pixels(smoke pixels) in the rgb image
1 个评论
回答(1 个)
Gautam
2024-10-24,6:06
Hello @senthil vadivu
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
- Identify White Pixels: Define a threshold to identify white pixels based on their RGB values.
- 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);
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!