how to smoothen only the high intensity pixel in a color image
3 ビュー (過去 30 日間)
古いコメントを表示
@Image Analyst i want to smoothen or reduce the pixel value high pixels can anyone help me with the code part
0 件のコメント
採用された回答
Image Analyst
2021 年 5 月 31 日
Just get a mask where the bright regions are, then blur the image and then replace only where it's blurred and in the mask
Something like (untested)
% Separate into individual color channels.
[r, g, b] = imsplit(rgbImage);
% Get mask of where the bright pixels are.
brightMask = rgb2gray(rgbImage) > 220; % Or whatever value you want.
% Blur entire image.
windowWidth = 15;
kernel = ones(windowWidth, windowWidth) / windowWidth^2;
blurryR = imfilter(r, kernel);
blurryG = imfilter(g, kernel);
blurryB = imfilter(b, kernel);
% Replace mask pixels with smoothed/blurred ones
r(brightMask) = blurryR(brightMask);
g(brightMask) = blurryG(brightMask);
b(brightMask) = blurryB(brightMask);
% Reconstruct output image from individual color channels.
outputImage = cat(3, r, g, b);
2 件のコメント
Image Analyst
2021 年 7 月 29 日
To dim the bright regions (ONLY) by 20 gray levels in each color channel, do this:
% Replace mask pixels with smoothed/blurred ones
r(brightMask) = blurryR(brightMask) - 20;
g(brightMask) = blurryG(brightMask) - 20;
b(brightMask) = blurryB(brightMask) - 20;
% Reconstruct output image from individual color channels.
outputImage = cat(3, r, g, b);
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で String についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!