//--------------------------------------------------------------------------- #ifndef ImageMatrixH #define ImageMatrixH //--------------------------------------------------------------------------- #include "global.h" #include "cgi-draw.h" #ifdef FITS #define COLOR_TYPE unsigned short #else #define COLOR_TYPE byte #endif typedef struct PIXEL_ITEM { short x; short y; struct PIXEL_ITEM *p_next; }pixel_item; class ImageMatrix { private: public: COLOR_TYPE **data; /* data of the colors */ COLOR_TYPE **starspix; /* pixels identified as stars */ long width,height; /* width and height of the picture */ char name[256]; /* the file name of the image */ double exposure_time; /* the exposure time of the picture */ double JulianDate; /* the julian date when the picture was taken */ COLOR_TYPE AvgColor; /* average color of the image background */ star_point *baseline_peaks; /* a data structure that hold the baseline peaks points from an external file */ int LoadImage(BITMAP bitmap,short inverted); /* load a bitmap into the ImageMatrix data structure */ int LoadFits(char *fits_file_name); /* load a fits file */ int SaveFits(char *fits_file_name); /* save the data to a fits file */ int GetPicture(BITMAP h_bitmap); /* load a fits image into a bitmap image */ long GetStarsPoints(star_point *star_points,stripe_point *stripes,double max_dist); long FindArea(short x,short y,short value,short *min_x,short *max_x,short *min_y,short *max_y); pixel_item *AddMarkPix(pixel_item *p_tail,short x,short y,long *counter); unsigned short IsStar(short x,short y); long GetStarsBackground(long x,long y); void GetStarSurface(long x,long y,long base_x,long base_y,unsigned short background,unsigned short sqrt_background,unsigned short *pixel_count,unsigned short *edge_count,unsigned short *sum_edge,unsigned short *maximum_edge,COLOR_TYPE *pixel_counts); long GetStarsColor(long x,long y,short top_pix_count,unsigned short background); double ClosestStar(long x,long y); void FreeImage(); int IsCloudArea(int x, int y); void DrawLabels(BITMAP bitmap,short resize,short right, short below, FONT font); int LoadBaselinePeaks(char *filename); void FindClouds(BITMAP bitmap); void FindClouds2(BITMAP bitmap,star_point *star_point,star_point *baseline_peaks); /* paint the clouded areas in the image */ int FindClouds3(site_info *location,star_point* StarPoints,char *baseline_image_name,BITMAP bitmap,short find_changes); long AverageMatrix(ImageMatrix *matrix, double weight); long IsClear(star_point *star_points, double clear_threshold); void ClearBackground(char *input_image,BITMAP bitmap,double max_dist); unsigned short DarkestPixel(double dist_from_center); void CompareBackground(BITMAP bitmap,char *baseline_image_name,double max_dist); long MarkUnknownStars(star_point *star_points,stripe_point *stripes,char *filename,BITMAP bitmap); int unwrap(BITMAP bitmap,double scale); }; #endif