필터 지우기
필터 지우기

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 (최근 30일)
Image = imread('cameraman.tif');
Image1 = double(Image);
For i=1:length(Image1)
kernel=ones(i); K=Conv2(Image1,kernel,same); Imshow(K)
end

답변 (1개)

Walter Roberson
Walter Roberson 2024년 2월 24일
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
Walter Roberson
Walter Roberson 2024년 2월 24일
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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by