MATLAB Answers


Dividing the image into blocks

Asked by kash
on 27 Nov 2012

I have a image, i want to divide into blocks until each pixel in block have same value for example in the link below i have an image

The image consists of waters ,leaves and green parts ,i want to dive into a block containing same values

please help


Jan Simon
on 27 Nov 2012

I do not see any picture on the linked page, but a lot of advertisments.

on 27 Nov 2012
dive into is divide into
assuming the value below taken from image 
im=   64    65    66    69    69
       64    66    68    70    72
       64    64    66    67    73
       64    62    64    62    67
       63    60    62    63    66
       64    62    60    63    67
       67    63    61    61    65
       67    68    67    63    63
in this pixel value 64 hase 4 values,so it must be in a block,63 must be block,64 must be block,last two 67s must be a block and so on ,in 4th and 5th columns 2 values of 69s must be grouped,and so on i.e same pixel valu must be in a block 

I didn't see a picture immediately either. When I clicked on the download link, my company threw up a page that says they've forbidden us to go to that web site. Please pick a site where we can see the image immediately, like or dozens of others.

What do you mean "grouped" or "in a block"? I think of a block as rectangular - what if your contiguous set of gray levels is not rectangular? Can you have blob-shaped "blocks"? If so are you talking about connected components labeling like done with bwlabel and bwconncomp?

1 Answer

Answer by Image Analyst
on 27 Nov 2012

kash, I know you've been doing image processing for over a year now and I know you know about bwlabel() and bwconncomp(), so tell me why doing something like

labeled67blobs = bwlabel(grayImage == 67); % Similar for any other number.

is not doing what you want?


on 27 Nov 2012

The image is

i saw tour demo at

like that i want to divide as in peppers image,

want to divide into sub image such that wach subimage has same pixel value

on 27 Nov 2012

labeled67blobs = bwlabel(grayImage == 67)

does not give answer

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!