如何将图像matlab划分为重叠块 [英] How to divide image matlab into overlapping block

查看:460
本文介绍了如何将图像matlab划分为重叠块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用matlab将512 * 512的图像分成41 * 41重叠的部分,换句话说,我想先获取一个以q为中心的41 * 41块,然后再移动一个像素,然后获取一个41 * 41以q + 1居中,依此类推..我不能使用Blockproc,因为它提供了一个不重叠的块.

I need to divide an image 512*512 into 41*41 overlapping using matlab.In other words, I want to take first a 41*41 block centred in q then I shift by a pixel and I take a 41*41 centered in q+1 and so on.. I can't use Blockproc because it gives a not overlapping block.

感谢帮助我

推荐答案

您可以使用BLOCKPROC.这不太明显.

You CAN use BLOCKPROC. It is a bit non-obvious.

将块大小设置为[1 1],然后使用'Border'参数指定每个像素周围所需的块大小:

Set a block size of [1 1], and then use the 'Border' parameter to specify how big a block you want around each pixel:

>> a

a =

     8     1     6
     3     5     7
     4     9     2

>> blockproc(a, [1 1], @(bs)disp(bs.data),'BorderSize', [1 1 ])
     0     0     0
     0     8     1
     0     3     5

     0     0     0
     1     6     0
     5     7     0

     0     3     5
     0     4     9
     0     0     0

     5     7     0
     9     2     0
     0     0     0

     0     0     0
     8     1     6
     3     5     7

     0     8     1
     0     3     5
     0     4     9

     8     1     6
     3     5     7
     4     9     2

     3     5     7
     4     9     2
     0     0     0

     1     6     0
     5     7     0
     9     2     0

这篇关于如何将图像matlab划分为重叠块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆