Divide an image into equal sized blocks using MATLAB and use Gabor filter

放肆的年华 提交于 2019-12-23 03:48:10

问题


How to divide a facial image of size 120x120 into 64 blocks of 15x15 pixel size using MATLAB? Then I want to convolve each 15x15 block with Gabor filter. I failed in using the blkproc function.How can I do this?


回答1:


To extract these blocks you can use the following, assuming img is a 120x120 image matrix, c=15, w=8:

blocks = reshape(permute(reshape(img, c, w, c, w), [1 3 2 4]), c, c, w * w)

Now blocks is a 15x15x64 matrix, and blocks(:, :, i) is a 15x15 matrix representing the i-th block.



来源:https://stackoverflow.com/questions/12078825/divide-an-image-into-equal-sized-blocks-using-matlab-and-use-gabor-filter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!