আইডিএল/নমুনা প্রোগ্রাম

pro center


image=read_bmp('C:\Users\Zilee\IDLWorkspace\Images\20031025_064105.bmp')

rimage=rebin(image,504,508)


x=504

y=508

z=256

p=200

q=p+1


finding x center

for j=p,y-q do begin

 s=0
 for i=0,x-1 do begin
   a=i*long(rimage(i,j))
   s=s+a
 endfor
 d=total(rimage(*,j))
 r=s/d

endfor

xcenter=mean(r)

print, 'xcenter'

print, xcenter


finding y center

for j=p,x-q do begin

 s=0
 for i=0,y-1 do begin
   a=i*long(rimage(j,i))
   s=s+a
 endfor
 d=total(rimage(j,*))
 ry=s/d

endfor

ycenter=mean(ry)

print, 'ycenter'

print, ycenter


shifting image to the calculated center

xshift=xcenter-(x/2-1)

yshift=ycenter-(y/2-1)

simage=shift(rimage,xshift,yshift)

window, 0, xsize=504, ysize=508

tvscl,simage


finding radius of shifted image

xc=round(xcenter)

yc=round(ycenter)

dia1=0

dia2=0

for m=0,500 do begin

 if simage(xc,m) gt 1 then dia1=dia1+1
 if simage(m,yc) gt 1 then dia2=dia2+1

endfor

radius=(dia1+dia2)/4

print, 'radius'

print, radius


image creation using distance function

dimg=dist(x,y)

sdimg=shift(dimg,x/2,y/2)


onion pilling of the Sun

rad=0

img=float(simage)

for i=0,26 do begin

 index=where((sdimg gt rad) and (sdimg le rad+8))
 sd=stddev(img(index))
 avg=mean(img(index))
 nring=where(img le avg+2*sd) or (img ge avg-2*sd)
 ringavg=mean(img(nring))
 ;print,ringavg
 img(index)=ringavg
 rad=rad+z/32

endfor

img(where(img eq 0))=1

window,1,xsize=504,ysize=508

tvscl, img


correcting to get perfect limb darkening

ringimage=(float(simage)/img)

window,2,xsize=504,ysize=508

tvscl, ringimage

end