フィルターのクリア

how to smoothen only the high intensity pixel in a color image

3 ビュー (過去 30 日間)
alexander
alexander 2021 年 5 月 31 日
コメント済み: Image Analyst 2021 年 7 月 29 日
@Image Analyst i want to smoothen or reduce the pixel value high pixels can anyone help me with the code part

採用された回答

Image Analyst
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 件のコメント
alexander
alexander 2021 年 6 月 4 日
Thank you so much sir
Image Analyst
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 ExchangeString についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by