Apply Average Filter on Image with just next-before 5 columns

조회 수: 2 (최근 30일)
Muaz Kartal
Muaz Kartal 2022년 5월 18일
답변: DGM 2022년 5월 19일
I need to apply average filter but i should take just the average of next and before 5 columns and insert to center one.
I tried this but it doesn't look like worked:
a = imread("bridge.bmp");
j = mat2gray(a,[0 255]);
h = fspecial("average",[5 1]);
filtered = imfilter(j,h);
imshow(filtered);

채택된 답변

DGM
DGM 2022년 5월 19일
Consider the example:
% a simple test image with a single white pixel in the center
inpict = zeros(13);
inpict(7,7) = 1;
% generate kernel such that target pixel is centered
fk = [1 1 1 1 1 1 1 0 0 0 0];
% ^ this is the target pixel
fk = fk/sum(fk(:)); % sum-normalize
% apply filter
outpict = imfilter(inpict,fk,'replicate');
imshow(outpict)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by