diff --git a/src/CUDA.cu b/src/CUDA.cu index c72fe57..3032e29 100644 --- a/src/CUDA.cu +++ b/src/CUDA.cu @@ -691,3 +691,4 @@ free_all: } extern "C" int MedFilter(float *ima, float **result, Filter *f, int sizex, int sizey){return 0;} extern "C" int GradFilterSimple(float *ima, float **result, Filter *f, int sizex, int sizey){return 0;} + diff --git a/src/NOCUDA.c b/src/NOCUDA.c index fef4410..eb2f73b 100644 --- a/src/NOCUDA.c +++ b/src/NOCUDA.c @@ -678,60 +678,6 @@ int MedFilter(float *ima, DBG("time=%f\n", dtime()-t0); return TRUE; } -/* - * Fill isolines' scale (an array) - * Input: - * f - filter for given method - * min - minimum value of intensity - * wd - max-min (dinamic range) - * Output: - * scale - a pointer to array (allocated in this function) - */ -int fillIsoScale(Filter *f, float **scale, float min, float wd){ - int M = f->w, y; - float (*scalefn)(float in); - float step, Nsteps = (float)f->w; // amount of intervals - float Suniform(float in){ - return step*in + min; - } - float Slog(float in){ - return expf(in*step) + min - 1.; - } - float Sexp(float in){ - return wd*logf(in*step) + min; - } - float Ssqrt(float in){ - return in*in*step*step + min; - } - float Spow(float in){ - return sqrtf(in*step) + min; - } - if(!scale) return FALSE; - - *scale = calloc(M, sizeof(float)); - if(!*scale) return FALSE; - switch(f->h){ - case LOG: - scalefn = Slog; step = logf(wd+1.)/Nsteps; - break; - case EXP: - scalefn = Sexp; step = expf(1.)/Nsteps; - break; - case SQRT: - scalefn = Ssqrt; step = sqrtf(wd)/Nsteps; - break; - case POW: - scalefn = Spow; step = wd*wd/Nsteps; - break; - default: - scalefn = Suniform; step = wd/Nsteps; - } - for(y = 0; y < M; y++){ - (*scale)[y] = scalefn(y+1); - DBG("level %d: I=%g", y, (*scale)[y]); - } - return TRUE; -} /* * Threshold filtering ("posterization") diff --git a/src/contours.c b/src/contours.c index ccb88e1..75942e6 100644 --- a/src/contours.c +++ b/src/contours.c @@ -1,17 +1,17 @@ // contours.c - find isophotos -// +// // Copyright 2011 Edward V. Emelianoff -// +// // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, @@ -19,6 +19,7 @@ #include "contours.h" #include "opengl.h" +#include "imtools.h" // contours' minimum size limits const int MIN_CONTOUR_SIZE = 4; @@ -174,7 +175,7 @@ int directions[16] = { int dxdy[9][2] = { {0 , 0}, // 0 {1 , 0}, // D_RIGHT - {-1, 0}, // D_LEFT + {-1, 0}, // D_LEFT {0 , 0}, {0 , 1}, // D_DOWN {0 , 0}, @@ -186,7 +187,7 @@ int dxdy[9][2] = { int newdirs[16][2] = { {0, 0}, // 0 {D_RIGHT,D_RIGHT},// D_RIGHT - {D_LEFT, D_LEFT}, // D_LEFT + {D_LEFT, D_LEFT}, // D_LEFT {D_RIGHT, D_LEFT},// D_RIGHT | D_LEFT {D_DOWN, D_DOWN}, // D_DOWN {D_RIGHT, D_DOWN},// D_DOWN | D_RIGHT @@ -194,7 +195,7 @@ int newdirs[16][2] = { {D_RIGHT, D_LEFT},// D_DOWN | D_RIGHT | D_LEFT {D_UP, D_UP}, // D_UP {D_RIGHT, D_UP}, // D_UP | D_RIGHT - {D_LEFT, D_UP}, // D_UP | D_LEFT + {D_LEFT, D_UP}, // D_UP | D_LEFT {D_RIGHT, D_UP}, // D_UP | D_RIGHT | D_LEFT {D_DOWN, D_UP}, // D_UP | D_DOWN {D_RIGHT, D_UP}, // D_UP | D_DOWN | D_RIGHT @@ -387,7 +388,7 @@ int process_it_(int x, int y, int lvl, float *imdata, unsigned char *mask){ Contour *cCur; unsigned char pt0 = mask[y*w1+x]; if(pt0 == 0 || pt0 > 14) return TRUE;; - do{ + do{ if(!contours[lvl]){ // countour wasn't created - create it contours[lvl] = new_clist(lvl); if(!contours[lvl]){ diff --git a/src/fitsview b/src/fitsview deleted file mode 100755 index 533c09b..0000000 Binary files a/src/fitsview and /dev/null differ diff --git a/src/imtools.c b/src/imtools.c index 436595b..0c2ebae 100644 --- a/src/imtools.c +++ b/src/imtools.c @@ -636,3 +636,58 @@ void filter_image( Window *window, force_redraw(window->drawingArea); } + +/* + * Fill isolines' scale (an array) + * Input: + * f - filter for given method + * min - minimum value of intensity + * wd - max-min (dinamic range) + * Output: + * scale - a pointer to array (allocated in this function) + */ +int fillIsoScale(Filter *f, float **scale, float min, float wd){ + int M = f->w, y; + float (*scalefn)(float in); + float step, Nsteps = (float)f->w; // amount of intervals + float Suniform(float in){ + return step*in + min; + } + float Slog(float in){ + return expf(in*step) + min - 1.; + } + float Sexp(float in){ + return wd*logf(in*step) + min; + } + float Ssqrt(float in){ + return in*in*step*step + min; + } + float Spow(float in){ + return sqrtf(in*step) + min; + } + if(!scale) return FALSE; + + *scale = calloc(M, sizeof(float)); + if(!*scale) return FALSE; + switch(f->h){ + case LOG: + scalefn = Slog; step = logf(wd+1.)/Nsteps; + break; + case EXP: + scalefn = Sexp; step = expf(1.)/Nsteps; + break; + case SQRT: + scalefn = Ssqrt; step = sqrtf(wd)/Nsteps; + break; + case POW: + scalefn = Spow; step = wd*wd/Nsteps; + break; + default: + scalefn = Suniform; step = wd/Nsteps; + } + for(y = 0; y < M; y++){ + (*scale)[y] = scalefn(y+1); + DBG("level %d: I=%g", y, (*scale)[y]); + } + return TRUE; +} diff --git a/src/include/CUtools.h b/src/include/CUtools.h index f894f1e..80fbb10 100644 --- a/src/include/CUtools.h +++ b/src/include/CUtools.h @@ -45,7 +45,6 @@ enum{ EXTERN int fill_hough_lines(float *ima, float min, float max, int imW, int imH, int Rmax, int angles, float *hough); EXTERN int DiffFilter(float *ima, float **result, Filter *f, int sizex, int sizey); EXTERN int MedFilter(float *ima, float **result, Filter *f, int sizex, int sizey); -EXTERN int fillIsoScale(Filter *f, float **scale, float min, float wd); EXTERN int StepFilter(float *ima, float **result, Filter *f, int sizex, int sizey, float min, float max, float **scale); EXTERN int GradFilterSimple(float *ima, float **result, Filter *f, int sizex, int sizey); #endif // _CUTOOLS_H_ diff --git a/src/include/imtools.h b/src/include/imtools.h index 98c5d73..79ea2d8 100644 --- a/src/include/imtools.h +++ b/src/include/imtools.h @@ -16,4 +16,5 @@ void get_circles_params(Window *window, IMAGE *ima); void hough_lines(Window *window); void get_houg_line(Window *window, double x, double y, double *phi_, double *R_); void filter_image(Window *window, Filter *f); +int fillIsoScale(Filter *f, float **scale, float min, float wd); #endif // _IMTOOLS_H_