mirror of
https://github.com/eddyem/fitsview-hartmann.git
synced 2025-12-06 02:35:18 +03:00
little fix
This commit is contained in:
parent
35a1e70547
commit
36de9a3712
@ -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;}
|
||||
|
||||
|
||||
54
src/NOCUDA.c
54
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")
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
|
||||
#include "contours.h"
|
||||
#include "opengl.h"
|
||||
#include "imtools.h"
|
||||
|
||||
// contours' minimum size limits
|
||||
const int MIN_CONTOUR_SIZE = 4;
|
||||
|
||||
BIN
src/fitsview
BIN
src/fitsview
Binary file not shown.
@ -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;
|
||||
}
|
||||
|
||||
@ -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_
|
||||
|
||||
@ -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_
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user