Borrar filtros
Borrar filtros

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

3 visualizaciones (últimos 30 días)
@Image Analyst i want to smoothen or reduce the pixel value high pixels can anyone help me with the code part

Respuesta aceptada

Image Analyst
Image Analyst el 31 de Mayo de 2021
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 comentarios
Image Analyst
Image Analyst el 29 de Jul. de 2021
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);

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by