dividing the image into blocks

I have a image below ,plz tell how to divide like this
plz assist
i need to draw lines over blocks,it may be 8x8 or 64x64,kindly assist

Respuestas (1)

Azzi Abdelmalek
Azzi Abdelmalek el 13 de Feb. de 2013
Editada: Azzi Abdelmalek el 13 de Feb. de 2013

2 votos

im=imread('pout.tif');
n=size(im,1);
m=size(im,2);
dl=3 ; % number of vertical portions
dc=2 ; % number of horizontal portions
a=fix(n/dl);
b=fix(m/dc);
n0=1;
portion=[];
ii=0;
for k=linspace(a,n,dl)
m0=1;
ii=ii+1;
jj=0;
for p=linspace(b,m,dc)
jj=jj+1;
im1=im(n0:k,m0:p,:);
portion{ii,jj}=im1;
m0=p+1;
end
n0=k+1;
end
portion

4 comentarios

nkumar
nkumar el 13 de Feb. de 2013
but the image is not displayed,has the image been divided into blocks
Azzi Abdelmalek
Azzi Abdelmalek el 13 de Feb. de 2013
Editada: Azzi Abdelmalek el 13 de Feb. de 2013
To display your portions
ii=0;
for k=1:dl
for p=1:dc
ii=ii+1;
subplot(dl,dc,ii);
imshow(portion{k,p});
end
end
nkumar
nkumar el 13 de Feb. de 2013
But Azzi it is not like in picture as i posted ,i need as in picture i posted,like vertical and horizontal lines,which indicate a block
Anurag Pujari
Anurag Pujari el 8 de Dic. de 2014
Very solid codes. Thanks to Azzi Abdelmalek. It is superb.

Iniciar sesión para comentar.

Categorías

Etiquetas

Preguntada:

el 13 de Feb. de 2013

Comentada:

el 8 de Dic. de 2014

Community Treasure Hunt

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

Start Hunting!

Translated by