From: Adam Bartoszewski on 3 Jan 2010 13:34 i think u r wrong at the beginning the centroid u r calculating should be calcualted from only the shape not the whole image. But anyway if u have fixed the problem i d apriciate if u could share the final code, because now im starting to code the GFD and also have some dificulties thanks in advance "shantini jey" <brutal_setan(a)hotmail.com> wrote in message <gp4jmi$ai2$1(a)fred.mathworks.com>... > hi, im doin shape based image retrieval using generic fourier descriptor.. > the methods to generating GFD are: > 1. Input shape image data f(x, y); > 2. Get centroid of the shape (xc, yc); > 3. Set the centroid as the origion; /* translation normalization */ > 4. Get the maximum radius of the shape image (maxRad); > 5. Polar Fourier transform > 6. Calculate FD > 7. Output feature vector FD. > > i've done some work on it.. but somehow the FD part is not correct.. > pls some1 help me... this is my coding... > > if nargin < 1 > error('Please load an image'); > end > > img = double(img); > [rows,cols] = size(img); > cy = round(rows/2); > cx = round(cols/2); > > if exist('radius','var') == 0 > rmax= min(round(rows/2),round(cols/2))-1; > end > radius = sqrt((cx-(rmax^2)) + (cy-(rmax^2))); > > if exist('angle','var') == 0 > angle = 360; > end > > pcimg = []; > i = 1; > > for r=0:rmax > j = 1; > > for a=0:2*pi/angle:2*pi-2*pi/angle > pcimg(i,j) = img(cy+round(r*sin(a)),cx+round(r*cos(a))); > j = j + 1; > end > i = i + 1; > end > > > %------------------------------------------------------ > > %FD > > function FD = frdescp(pcimg) > > FR= pcimg(i,j)*cos(2*pi*r*(radius/rmax) + angle*a); %real part of spectra */ > FI= pcimg(i,j)*sin(2*pi*r*(radius/rmax) + angle*a); %imaginary part of spectra */ > > > > if (angle==0 && radius==0) > > FD(0) = sqrt((FR^2+ FR^2)/(pi*maxRad^2)); > Else > FD(r+ang) = sqrt((FR^2*(r*angle) + FI^2*(radius*angle))/ FD(0)); > end > n can some1 pls explain wat is output feature vector FD.. > thankz a million in advance
|
Pages: 1 Prev: To draw the major and minor axis of an ellipse Next: matrix inverse using qr decomposition |