how to divide an image into 3*3 block?for each block i have to calculate mean and standard deviation for each block

Answers (2)

You can use blockproc
im=imread('your_image')
[n,m]=size(im)
n1=ceil(n/3)
m1=ceil(m/3)
im_mean=blockproc(im,[n1,m1],@(x) mean(x.data(:)))
im_std=blockproc(im,[n1,m1],@(x) std(double(x.data(:))))
You can use blockproc(), in the Image Processing Toolbox. I have two demos where it's used in several ways to produce a variety of effects. Run them and see how you can perform different functions (like mean and std) and get different output sizes. It should be quite instructive.

Tags

Asked:

on 3 May 2014

Answered:

on 3 May 2014

Community Treasure Hunt

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

Start Hunting!