how to subtract small window from an image by shifting pixel by pixel

1 回表示 (過去 30 日間)
Hanif Ullah
Hanif Ullah 2019 年 5 月 29 日
回答済み: Murugan C 2019 年 6 月 3 日
I want to take small window from image and subtract that small window from whole image by shifting pixels by pixels. like for example I have 10x10 pixel image and I select a 3x3 pixels window from that image and subtract that 3x3 pixels image from whole 10x10 pixel image by shifting that mask window on whole image. Screenshot_1.jpg

採用された回答

Murugan C
Murugan C 2019 年 6 月 3 日
Hi,
inp_img = double(imread('cameraman.tif'));
figure
subplot(1,2,1);
imshow(inp_img,[]);
sub_mask_window = [14 25 16; 6 32 24; 35 13 44]; % creating mask window
for i = 1 : 2 : size(inp_img,1) - 2
for j = 1 : 2 : size(inp_img,2) - 2
subtract_img(i : i + 2, j : j + 2) = inp_img(i : i + 2, j : j + 2)...
- sub_mask_window; % subtracting mask window with image
end
end
subplot(1,2,2);
imshow(subtract_img)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Filtering and Enhancement についてさらに検索

製品


リリース

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by