Dividing the image into blocks

조회 수: 8 (최근 30일)
kash
kash 2012년 11월 27일
편집: Image Analyst 2018년 11월 30일
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
kash
kash 2012년 11월 27일
편집: Image Analyst 2018년 9월 12일
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 has 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 value must be in a block
Image Analyst
Image Analyst 2012년 11월 27일
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?

댓글을 달려면 로그인하십시오.

답변 (2개)

Image Analyst
Image Analyst 2012년 11월 27일
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
kash
kash 2012년 11월 27일
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
kash
kash 2012년 11월 27일
labeled67blobs = bwlabel(grayImage == 67)
does not give answer

댓글을 달려면 로그인하십시오.


Salma Hassan
Salma Hassan 2018년 9월 11일
편집: Walter Roberson 2018년 9월 11일
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
suha athab
suha athab 2018년 11월 30일
편집: Image Analyst 2018년 11월 30일
Your code is very useful for me, but I wonder, if I can display only the block with maximum mean value, what will I do? Please answer me.
Image Analyst
Image Analyst 2018년 11월 30일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 3-D Volumetric Image Processing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by