MATLAB Answers

Dividing the image into blocks

55 views (last 30 days)
kash
kash on 27 Nov 2012
Edited: Image Analyst on 30 Nov 2018
I have a image that 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 keep dividing into blocks until it contains the same value.
Please help.
  4 Comments
Image Analyst
Image Analyst on 27 Nov 2012
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 tinypic.com 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?

Sign in to comment.

Answers (2)

Image Analyst
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?
  2 Comments
kash
kash on 27 Nov 2012
labeled67blobs = bwlabel(grayImage == 67)
does not give answer

Sign in to comment.


Salma Hassan
Salma Hassan on 11 Sep 2018
Edited: Walter Roberson on 11 Sep 2018
i=imread('image_1_0.png');
i=imresize(i,[256 256]);
a=64; b=64; %window size
x=size(i,1)/a; y=size(i,2)/b;
m=a*ones(1,x); n=b*ones(1,y);
C =mat2cell(i,m,n);
C = C(:);
%# display tiles i subplots
for j=1:a*b
block_image = mean2(C{j});
if block_image > 10
imshow( C{j} )
end
end
  5 Comments
Image Analyst
Image Analyst on 30 Nov 2018
It is not necessary that you do ONLY that. You can do whatever you want. You can keep track of the means for all block and display only the single block that has the highest mean if you want. See my attached blockproc demos.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by