Matlab Code For The Simulation Of Detection Of Radius Of Stars

I (Loisel 20:52, 14 Sep 2004 (UTC)) created the images
      
with some Matlab code I wrote. I release this Matlab code into the public domain. If you put power=0 in the code below, the blurry star image looks like complete noise, but somehow it still is able to compute the star radius. It's uncanny. Here is the code..
  function radius,star,starft,blurrystar,blurryft,thresholded,thresholded1=make_star(n,r0,power,threshold);  % try radius=make_star(150,15,6,25)  coords=(-n/2):(n/2-1);  % create a random filter that tapers off near the edge  filter=random('unif',0,1,n,n);  dampen=(cos((coords)*2*pi/n)+1)/2;  dampen2=(ones(n,1)*dampen).^power.*(dampen'*ones(1,n)).^power;  filter3=filter.*dampen2;  filter4=real(filter3/sum(sum(filter3)));  % create an off-center star  x0=random('unif',-n/20,n/20);  y0=random('unif',-n/20,n/20);  xc=ones(n,1)*coords;  yc=(coords)'*ones(1,n);  star=(((xc-x0).^2+(yc-y0).^2)<=(r0^2))+0;  % compute a blurry star  blurrystar=conv2(star,filter4,'same');  % compute the FFT of the blurry star  blurryft2=fft2(blurrystar);  % shift fft origin to center of matrix  modcoords=mod(coords,n)+1;  blurryft(modcoords,modcoords)=blurryft2;  starft2=fft2(star);  starft(modcoords,modcoords)=starft2;    %threshold and compute radius of star  thresholded=((abs(starft)m,n=size(img);  figure('Units','pixels','Position',100 2*n 2*m,'Name','Star');  imagesc(img); colormap(gray); set(gca,'Position',0 1 1);  line(n/2+1,n/2+1,1,m,'Linestyle',':','Color','r');  line(1,n,m/2+1,m/2+1,'Linestyle',':','Color','r');  img=blurrystar; m,n=size(img);  figure('Units','pixels','Position',100 2*n 2*m,'Name','Blurry star');  imagesc(img); colormap(gray); set(gca,'Position',0 1 1);  line(n/2+1,n/2+1,1,m,'Linestyle',':','Color','r');  line(1,n,m/2+1,m/2+1,'Linestyle',':','Color','r');  img=log(abs(starft)); m,n=size(img);  figure('Units','pixels','Position',400 2*n 2*m,'Name','Star Fourier transform');  imagesc(img); colormap(gray); set(gca,'Position',0 1 1);  line(n/2+1,n/2+1,1,m,'Linestyle',':','Color','r');  line(1,n,m/2+1,m/2+1,'Linestyle',':','Color','r');  line(r1*cos(pi*(0:.1:2))+m/2+1,r1*sin(pi*(0:.1:2))+n/2+1,'Linestyle',':','Color','b');  img=log(abs(blurryft)); m,n=size(img);  figure('Units','pixels','Position',400 2*n 2*m,'Name','Blurry star Fourier transform');  imagesc(img); colormap(gray); set(gca,'Position',0 1 1);  line(n/2+1,n/2+1,1,m,'Linestyle',':','Color','r');  line(1,n,m/2+1,m/2+1,'Linestyle',':','Color','r'); 
line(radius1*cos(pi*(0:.1:2))+m/2+1,radius1*sin(pi*(0:.1:2))+n/2+1,'Linestyle',':','Color','b');

 

<< PreviousWord BrowserNext >>
tickling boots
optic tract
digby, nova scotia
michael white
laface
william broomfield
usa soil taxonomy
arts and industries building
optic radiations
brett butler (comedienne)
speed skating at the 1924 winter olympics
mediamoo
amami oshima
galach
international committee on anthropogenic soils
professional baseball
picmicro
ethers
amien rais
linguamoo
dave graveline
thomas morley
st. gall gospel book
speed skating at the 1932 winter olympics
dishwasher pete
arthur sinclair
an american tail
sumit
special olympic games
habanera (music)
semagic
philadelphia and reading railroad
duke point, british columbia
auxology
cameo (band)
ethelbert of york
speed skating at the 1936 winter olympics
demi gods and semi devils
ivar ballangrud
henry the black
peter jensen
brown sabbath
teredo
across variable