Syntax for using 'blockproc' command to divide a .jpg image into blocks
Show older comments
I have a problem where I need to subdivide the image into smaller blocks. While this is quite easy for gray image by using mat2cell command (input image being 2D array or matrix), same is not true (at least for me now) for color image (being 3D array). I find that 'blockproc' is the proper way to use 'mat2cell' for each layer of the color image. But somehow I am not very comfortable with the explanation of the syntax for using 'blockproc'. It will be very help full if the proper syntax is given to me.
Answers (2)
Walter Roberson
on 18 Apr 2013
B = 8; %e.g., 8 x 8
ImageBlocks = mat2cell( YourRGBImage, B * ones(1, size(YourRGBImage,1)/B), B * ones(1, size(YourRGBImage,2)/B), size(YourRGBImage,3) );
Note: this will also work for grayscale images.
Bidyut Chakraborty
on 19 Apr 2013
Edited: Bidyut Chakraborty
on 19 Apr 2013
Categories
Find more on Neighborhood and Block Processing 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!