1

I spent quite some time on understanding and applying the Matlab function blockproc. I also read some posts on stackoverflow on this function, like this, and this one, still I can not utilize the function as I want.

Basically, all I want is a sliding window on my image, which overlaps the windows, but does not (zero-) pad the edges of the image.

For example, on a 10x10 image, I'd like to apply a 8x8 window, with an overlap of 2. IF

img = reshape(1:100,[10,10]);

then, in Matlab-Notation, I'd like to get the

desired ranges:

    [1:8,  1:8] [1:8,  3:10]
    [3:10, 1:8] [3:10, 3:10]

The command I thought would do the trick is:

fun = @(block_struct) mean2(block_struct.data); 
blockproc(img, [4,4], fun, 'BorderSize', [2,2], 'TrimBorder', true)

Where, 4+2*2=8 is my windowsize, and the 2 indicates the overlap. However this does not work. I tried other combinations of parameters and values, but with no luck.

I would be really glad if someone could help me out! Thanks in advance!

Community
  • 1
  • 1
muuh
  • 1,013
  • 12
  • 24
  • Your problem is that `blockproc` uses "outside" of the image? Why not compute everything and just dump the part you dont like? you have time requirements? – Ander Biguri Aug 26 '16 at 09:09

0 Answers0