how to divide an 512*512 image into 8*8 blocks??

5 visualizaciones (últimos 30 días)
priya
priya el 22 de En. de 2014
Editada: Mihir Daptardar el 22 de En. de 2014
i want to divide an 512*512 image into 8*8 blocks using matlab can u please help me

Respuestas (3)

Mihir Daptardar
Mihir Daptardar el 22 de En. de 2014
Editada: Mihir Daptardar el 22 de En. de 2014
You can use the mat2cell command to subdivide the matrix. For this particular case, please refer to the following code snippet. Please make sure that your inputSqMat is exactly divisible into the subDivisions
function out = cropping(inputSqMat, subDivisions)
lengthSqMat = size(inputSqMat,1);
subDivisionVect = subDivisions*ones(1, lengthSqMat/subDivisions);
out = mat2cell(inputSqMat, subDivisionVect, subDivisionVect);
To access a particular element, you can index into the variable. For example:
out{1,1}

Matt J
Matt J el 22 de En. de 2014
Using MAT2TILES,
mat2tiles(yourImage,[8,8]);

Image Analyst
Image Analyst el 22 de En. de 2014
See the FAQ for two ways to do it, one using cell arrays, and one not.

Categorías

Más información sobre Image Processing Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by