;This program is designed to identify stars in an auroral or airglow ;image; specifically those taken at Rabbit Lake. The purpose of this is so that ;the exact position of the star will be known in row and column terms of the ;image, and by comparing these coordinates with known positions of the stars at ;the time of the exposure, a correlation between image position and sky position ;can be established. ;The process compares the image with those taken directly before and ;after the specified image, so the program will read in the specified image and ;the images preceeding and proceeding the specified image. The images chosen are ;based on the camera and filter numbers, the exposure time and consecutive image ;numbers. Since the program is to be used to identify stars, the ideal images ;are those with clearly visible stars and almost no cloud or aurora. ; ;Modified on May 8, 1994 by T A Oliynyk: can now be used on unix or dos machines. ;Variables: ;rimg : (256,256,3) array containing the 3 images being compared ; @isitdos !ORDER=1 WINDOW,0 da=0. & cam=0. & filt=0. & exp=0. & mode=0. & imnum=0. ;obtain information fron the user so the correct file can be read PRINT,'Input day of month, camera, filter, exposure length, mode of operation,' PRINT,'and image extension number' PRINT,'(MODES : 0 - Aurora)' PRINT,'( 1 - Bias)' PRINT,'( 2 - Calibration)' PRINT,'( 3 - Dark Frame)' PRINT,'( 4 - Flat Field)' PRINT,'( 5 - Airglow)' read,da,cam,filt,exp,mode,imnum ;initializing variables img = INTARR(256,256,3) ;array of the 3 images which will be compared rimg = img & srimg=img & ptimg = img stim = INTARR(256,256,3) stimg = INTARR(256,256) & finimg = stimg gstar = fltarr(256,256) & stimg2 = stimg rdmeandk,FIX(cam),FIX(exp),dk WHILE imnum-1 LT 0 DO BEGIN ;cannot have an extension number less than zero PRINT,'Please choose a new image number since there is no image previous to this one' READ,imnum ENDWHILE path = STRING(mpaths(mode),dd,cam,dd,filt,dd,firstchars(mode),da,cam,filt,exp,$ imnum,$ FORM='(A,A1,"c",I1,A1,"f",I1,A1,A,I2.2,2I1,I3.3,".",I3.3)') ;filename of ;image ;find all images with the same filename, excluding the extension ;this is used to find the images previous to and following the image path2=STRING(mpaths(mode),dd,cam,dd,filt,dd,firstchars(mode),da,cam,filt,exp,$ FORM='(A,A1,"c",I1,A1,"f",I1,A1,A,I2.2,2I1,I3.3,".*")') fl=findfile(path2) w=where(fl eq path) w=w(0) file=strarr(3) ;read in the image, the one with the same cam, filt, exposure, one image before ;the specified image, and the image after. FOR j=w-1,w+1 DO file(j-(w-1))=fl(j) FOR i=0,2 DO BEGIN print,file(i),FORM='("READING : ",A)' rdkimg,file(i),hb,ximg kh = gethd(hb) help,/st,kh.misc.tm rimg(*,*,i) = ximg(*,*) IF i EQ 1 THEN head = hb ENDFOR imgg=rimg FOR i=0,2 DO BEGIN tpt=0 & pt=0 & pt2=0 & bpt= 0 & x=0 ns=1.5 ng=2. dr=2. dim=SIZE(rimg(*,*,i)) g1=ABS(rimg(*,*,i)-SHIFT(rimg(*,*,i),dr,0)) g1(dr-1,*)=0 sd = STDEV(g1,m) & gt1=m+ns*sd g1big=WHERE(g1 GT gt1) IF (g1big(0) NE -1) THEN big1=g1(g1big) ELSE big1=-1 g2=ABS(rimg(*,*,i)-SHIFT(rimg(*,*,i),0,dr)) g2(*,dim(2)-dr)=0 sd = STDEV(g2,m) & gt2=m+ns*sd g2big=WHERE(g2 GT gt2) IF (g2big(0) NE -1) THEN big2=g2(g2big) ELSE big2=-1 g3=ABS(rimg(*,*,i)-SHIFT(rimg(*,*,i),-dr,0)) g3(dim(1)-dr,*)=0 sd = STDEV(g3,m) & gt3=m+ns*sd g3big=WHERE(g3 GT gt3) IF (g3big(0) NE -1) THEN big3=g3(g3big) ELSE big3=-1 g4=ABS(rimg(*,*,i)-SHIFT(rimg(*,*,i),0,-dr)) g4(*,dr-1)=0 sd = STDEV(g4,m) & gt4=m+ns*sd g4big=WHERE(g4 GT gt4) IF (g4big(0) NE -1) THEN big4=g4(g4big) ELSE big4=-1 gradthresh=MAX([gt1,gt2,gt3,gt4]) ; select the largest gradient vbig=WHERE(big1 GT gradthresh) ; restrict big gradients to IF (vbig(0) NE -1) THEN g1big=g1big(vbig) ELSE g1big=-1;those greater than gradthresh vbig=WHERE(big2 GT gradthresh) IF (vbig(0) NE -1) THEN g2big=g2big(vbig) ELSE g2big=-1 vbig=WHERE(big3 GT gradthresh) IF (vbig(0) NE -1) THEN g3big=g3big(vbig) ELSE g3big=-1 vbig=WHERE(big4 GT gradthresh) IF (vbig(0) NE -1) THEN g4big=g4big(vbig) ELSE g4big=-1 nbig=INTARR(dim(1),dim(2)) ; no. of big gradients at each pixel IF (g1big(0) NE -1) THEN nbig(g1big)=nbig(g1big)+1 IF (g2big(0) NE -1) THEN nbig(g2big)=nbig(g2big)+1 IF (g3big(0) NE -1) THEN nbig(g3big)=nbig(g3big)+1 IF (g4big(0) NE -1) THEN nbig(g4big)=nbig(g4big)+1 toobig=WHERE(nbig GE ng) r=toobig/dim(1) c=toobig MOD dim(1) tmp=WHERE(((dr-1 LT c) AND (c LT dim(1)-dr)) AND $ ((dr-1 LT r) AND (r LT dim(2)-dr))) toobig=toobig(tmp) r=r(tmp) & c=c(tmp) stimg = INTARR(256,256) stimg(toobig) = rimg(toobig +i*256.^2.) ;here, we have either stars or hot spots pt = where((stimg GT 0) AND stimg GE SHIFT(stimg,1,0) $ AND stimg GE SHIFT(stimg,0,1) $ AND stimg GE SHIFT(stimg,-1,0) $ AND stimg GE SHIFT(stimg,0,-1) $ AND stimg GE SHIFT(stimg,0,2) $ AND stimg GE SHIFT(stimg,2,0) $ AND stimg GE SHIFT(stimg,0,-2) $ AND stimg GE SHIFT(stimg,-2,0) $ AND stimg GE SHIFT(stimg,1,1) $ AND stimg GE SHIFT(stimg,1,-1) $ AND stimg GE SHIFT(stimg,-1,1) $ AND stimg GE SHIFT(stimg,-1,-1)) stimg2 = INTARR(256,256) stimg2(pt) = stimg(pt) ptimg(*,*,i)=stimg2 gt 0 ENDFOR surr=INTARR(5,5)+1 d0img = DILATE(ptimg(*,*,0),surr) d2img = DILATE(ptimg(*,*,2),surr) finimg = d0img AND ptimg(*,*,1) AND d2img tvscl,ptimg(*,*,1),2 tvscl,finimg,0 im = ptimg(*,*,1)-finimg tvscl,im,3 tvscl,rimg(*,*,1)