How to create a 7 X 7 window?

조회 수: 3 (최근 30일)
Sabarinathan Vadivelu
Sabarinathan Vadivelu 2012년 10월 27일
I have an image with a size of 512X512. I want to create a 7X7 window to do some operations. But want to process all the pixels?? How can I do?? Zero padding is possible???

답변 (3개)

Wayne King
Wayne King 2012년 10월 27일
You can use blockproc() to apply some processing on blocks of a prescribed size.
  댓글 수: 1
Sabarinathan Vadivelu
Sabarinathan Vadivelu 2012년 10월 27일
IS it possible to use for loops to get the area and process? But when using for loop, Im getting Error that Index exceeds Matrix Dimensions. How to clear it?

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


Matt J
Matt J 2012년 10월 27일
편집: Matt J 2012년 10월 27일
If it's applicable, you could use MAT2TILES from the File Exchange, and do
A=rand(512);
B=mat2tiles(A,[7,7]);
for i=1:numel(B)
process(B{i});
end

Image Analyst
Image Analyst 2012년 10월 27일
It depends on what you want to do. For a simple 7x7 filter window moving over by one pixel at a time, you can use conv2() or imfilter(). If you want to move in "jumps" of 7 (so that you won't have any overlapping windows) then you can use blockproc. This is probably less common than moving over a pixel at a time. Finally if you need something custom and complicated, you can use nlfilter().
What does "zero padding possible" mean? Every filter will have edge effects and sometimes you are given the opportunity to handle them in prescribed ways. If you want some kind of custom edge behavior then you'll have to write something custom.
I can help more if you define what "some operations" means. For example if you want to do something like local max, standard deviation, entropy, skeletonize, etc. there are special functions for those kinds of things. To determine if there is a routine already in the toolbox that will do what you want to do, you have to tell us what you want to do.

Community Treasure Hunt

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

Start Hunting!

Translated by