DSPRelated.com
Forums

image segmentation

Started by Anshu October 25, 2004
Hi all
 
I have a 144 X 144 image and I want to divide it into 144 images of 12X 12 size each.Is there any matlab function to do this?
 
Anshu

__________________________________________________



Anshu,

There is something called as block processing. If you want to perform
same process on the whole image. For more information refer matlab
help.

Dont know whether matlab provides any help with dividng of image. But
I think its not tuf to write one for urself.. I attempeted to write
one .. this is the m code im = imread('image.jpg'); % I assume that image size is 144 x 144

xLength = 12;
yLength = 12;

numOfImages = (144*144)/(xLength * yLength); % you can change the size
later on if you want to
a = zeros( xLength , yLength ,numOfImages); % 'a' is a 3 D array that
has the divided image

for i = 0 : numOfImages - 1

xStart = mod(i , xLength) * xLength +1;
yStart = floor(i / 12) + 1 ;
a(:,:,i + 1)= im( xStart: xStart + xLength -1 , yStart : yStart +
yLength-1);
end

I agree its not robust... it doesnt have any loop to chk for any
errors.. but it does work for 12 x 12.. Hope this helps
Tarang
On Mon, 25 Oct 2004 10:25:57 -0700 (PDT), Anshu <> wrote:
>
> Hi all
>
> I have a 144 X 144 image and I want to divide it into 144 images of 12X 12
> size each.Is there any matlab function to do this?
>
> Anshu
>
> __________________________________________________
>
>
> _____________________________________
> Note: If you do a simple "reply" with your email client, only the author of
> this message will receive your answer. You need to do a "reply all" if you
> want your answer to be distributed to the entire group.
>
> _____________________________________
> About this discussion group:
>
> To Join:
>
> To Post:
>
> To Leave:
>
> Archives: http://www.yahoogroups.com/group/matlab
>
> More DSP-Related Groups: http://www.dsprelated.com/groups.php3 >
> ________________________________
> Yahoo! Groups Links
>
> To
> ________________________________
> Yahoo! Groups Links
>
> To