Borrar filtros
Borrar filtros

Hi I have a problem when I preform the convolution original image with kernel of ones as the size of the kernel increases the output is appearing totally white Image.

2 visualizaciones (últimos 30 días)
Image = imread('cameraman.tif');
Image1 = double(Image);
For i=1:length(Image1)
kernel=ones(i); K=Conv2(Image1,kernel,same); Imshow(K)
end

Respuestas (1)

Walter Roberson
Walter Roberson el 24 de Feb. de 2024
Image = imread('cameraman.tif');
Image ranges from uint8 0 to uint8 255
Image1 = double(Image);
Image1 ranges from double 0 to double 255.
kernel=ones(i); K=Conv2(Image1,kernel,same);
Because of the convolution, up to i^2 locations are added together. The output could be between double 0 and double 255*(i^2) . When you add together numbers that are integral values, then you get results that are integral values, so you are going to get results that are strictly 0, 1, 2, ...
Imshow(K)
K is double 0 to (possibly) double 255*(i^2).
When imshow() is passed a double precision array, then the data is assumed to be between double 0 and double 1, and everything else is clipped to that range. But the values happen to be strictly 0, 1, 2, ... and clipping that to the range 0 to 1 will result in 0 where the data was 0, and will result in 1 everywhere else.
  1 comentario
Walter Roberson
Walter Roberson el 24 de Feb. de 2024
Image = imread('cameraman.tif');
Image1 = im2double(Image);
tiledlayout('flow');
for i=5:5:40
kernel = ones(i) / (i^2);
K = conv2(Image1,kernel, 'same');
nexttile();
imshow(K); title(string(i));
end

Iniciar sesión para comentar.

Categorías

Más información sobre Images en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by