problem of applying block processing function

my image is gray scale image of 100*120. my programme is
*fun=@(x) x.*2;
B = blkproc(I,[4 4],[1 1],fun);*
when i'm looking for 1st sub block it gives only a single number, it equals to the twice of (1,1) pixel value of original image. can't i get the twice of 1st 4*4 block.is it possible or not.

 Accepted Answer

It gives a single number but you can multiply by ones(blockSize) to expand it. See the attached demos scripts.

8 Comments

can you please edit my codes.thanks.
my 1st sub block is[1 12 3 5;34 78 9 4;1 2 3 4;5 6 7 8]; when i'm run my programme,it gives only 2 for the out put of B(1,1).but i want to get this[2 24 6 10;68 156 18 8;2 4 6 8;10 12 14 16].how can i get this.
I don't know what you're doing. You didn't attach your code. Can't you figure it out from the two examples I gave you? No need to accept an answer until your problem is solved.
sorry.i dont know how to figure out this.
Figure what? Figure out how to download and run the two well-commented examples I included? Just click on the filenames, type control-a, control-c, go to an empty/new editor window in MATLAB, and type control-v, then click the green triangle. Go here for more help http://www.mathworks.com/matlabcentral/answers/8026-best-way-s-to-master-matlab
It gives the error message ??? Undefined function or method 'blockproc' for input arguments of type 'function_handle'.
Error in ==> Untitled at 44 blockyImage8 = blockproc(single(grayImage), blockSize, medianFilterFunction);
You must have a really, really old version of MATLAB. It had a different name back then, something like blkproc, blkprc, or something like that. You need to find out what it's called in your ancient version of MATLAB. Or just upgrade.
I,m working with R2009a,it uses blkproc. but is there any method in matlab to find the old codes.

Sign in to comment.

More Answers (0)

Categories

Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!