DSPRelated.com
Forums

RE: Re Image Processing

Started by SRINIVASAN Seetharaman April 17, 2001
Hi ,
I am new to matlab programming,
may be this question might be very funda, but i want to know,

I created image of size 50x50 but it says
"index is outof size in" "if (double(im(x1,y1)) ==1)"

can anyone clarify me how this line acts or what it does

also can anyone suggest me good books on Matlab working..

srini s

> ----------
> From: [SMTP:]
> Sent: Thursday, April 12, 2001 11:39 AM
> To:
> Subject: [matlab] Re Image Processing > here is the source code (matlab) and you just change the path and
> specify the image ( i have made this code for the image which is
> binary image and is black solid object on it its size is 50*50, and i
> have assumed its center at 25*25 of the image, but you can aldo find
> the center of any image using moment...) > Source code for this operation is listed below:
> This module finds points on the boundary of the object
>
> function output =findPoints(im)
> [r c] = size(im);
>
> ctrx%;
> ctry%;
>
> index = 1;
> for theta = 0:.1:(2*pi)
> for r=0:1:100
> x = r*cos(theta);
> y = r*sin(theta);
>
> x1=fix(ctrx+x);
> y1=fix(ctry+y);
>
> if (double(im(x1,y1)) ==1)
> output(1,index) = x1;
> output(2,index) = y1;
> index = index + 1;
> break;
> end
> end
> end >
> Main module which performs the above task > img = imread('c:\polygone.bmp');
> imshow(im);
>
> cords=findPoints(im);
>
> for i=1:length(cords)-1
> line([cords(2,i),cords(2,i+1)],[cords(1,i),cords(1,i+1)]);
> end >
> _____________________________________
> 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
>
> ">http://docs.yahoo.com/info/terms/