File Exchange

image thumbnail

Block Division using cell

version (1.77 KB) by Suraj Kamya
Using cell data type one can effectively breaks the 2D/3D data in to required no. of blocks.


Updated 21 Feb 2013

View License

Two functions are provided; one to break the data in blocks and another one to recombine them in proper order.
- Code given can break any 2d image into 8*8 blocks and put them in a cell. For ex. function assumes the input image of size 512x512 and it will break this image in to 4096 blocks of 8x8 elements each.
- One can perform desired operation on each block individually like watermarking, enhancement etc.
- After processing second function accept 4096 blocks (a single cell) as input and gives back original image back.

Cite As

Suraj Kamya (2021). Block Division using cell (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (7)

shital shinde

can any body know how we can do this using parallel parfor loop


vinita k

Thanks for the code. Its working properly for 512x512 image. But its not working for variable image size for example say image size is 768x1024. So how code will be change for such image?

priya dnanabal

how use this code....


Thanks , code is perfect.

Suraj Kamya

Thank you


See imsplit (File ID: #40173) for more options.

Also, cell2mat should be an faster way to glue the blocks back together.

MATLAB Release Compatibility
Created with R2011b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!