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 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;}
|
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);
|
DBG("time=%f\n", dtime()-t0);
|
||||||
return TRUE;
|
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")
|
* Threshold filtering ("posterization")
|
||||||
|
|||||||
@ -1,17 +1,17 @@
|
|||||||
// contours.c - find isophotos
|
// contours.c - find isophotos
|
||||||
//
|
//
|
||||||
// Copyright 2011 Edward V. Emelianoff <eddy@sao.ru>
|
// Copyright 2011 Edward V. Emelianoff <eddy@sao.ru>
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// 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
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2 of the License, or
|
// the Free Software Foundation; either version 2 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "contours.h"
|
#include "contours.h"
|
||||||
#include "opengl.h"
|
#include "opengl.h"
|
||||||
|
#include "imtools.h"
|
||||||
|
|
||||||
// contours' minimum size limits
|
// contours' minimum size limits
|
||||||
const int MIN_CONTOUR_SIZE = 4;
|
const int MIN_CONTOUR_SIZE = 4;
|
||||||
@ -174,7 +175,7 @@ int directions[16] = {
|
|||||||
int dxdy[9][2] = {
|
int dxdy[9][2] = {
|
||||||
{0 , 0}, // 0
|
{0 , 0}, // 0
|
||||||
{1 , 0}, // D_RIGHT
|
{1 , 0}, // D_RIGHT
|
||||||
{-1, 0}, // D_LEFT
|
{-1, 0}, // D_LEFT
|
||||||
{0 , 0},
|
{0 , 0},
|
||||||
{0 , 1}, // D_DOWN
|
{0 , 1}, // D_DOWN
|
||||||
{0 , 0},
|
{0 , 0},
|
||||||
@ -186,7 +187,7 @@ int dxdy[9][2] = {
|
|||||||
int newdirs[16][2] = {
|
int newdirs[16][2] = {
|
||||||
{0, 0}, // 0
|
{0, 0}, // 0
|
||||||
{D_RIGHT,D_RIGHT},// D_RIGHT
|
{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_RIGHT, D_LEFT},// D_RIGHT | D_LEFT
|
||||||
{D_DOWN, D_DOWN}, // D_DOWN
|
{D_DOWN, D_DOWN}, // D_DOWN
|
||||||
{D_RIGHT, D_DOWN},// D_DOWN | D_RIGHT
|
{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_RIGHT, D_LEFT},// D_DOWN | D_RIGHT | D_LEFT
|
||||||
{D_UP, D_UP}, // D_UP
|
{D_UP, D_UP}, // D_UP
|
||||||
{D_RIGHT, D_UP}, // D_UP | D_RIGHT
|
{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_RIGHT, D_UP}, // D_UP | D_RIGHT | D_LEFT
|
||||||
{D_DOWN, D_UP}, // D_UP | D_DOWN
|
{D_DOWN, D_UP}, // D_UP | D_DOWN
|
||||||
{D_RIGHT, D_UP}, // D_UP | D_DOWN | D_RIGHT
|
{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;
|
Contour *cCur;
|
||||||
unsigned char pt0 = mask[y*w1+x];
|
unsigned char pt0 = mask[y*w1+x];
|
||||||
if(pt0 == 0 || pt0 > 14) return TRUE;;
|
if(pt0 == 0 || pt0 > 14) return TRUE;;
|
||||||
do{
|
do{
|
||||||
if(!contours[lvl]){ // countour wasn't created - create it
|
if(!contours[lvl]){ // countour wasn't created - create it
|
||||||
contours[lvl] = new_clist(lvl);
|
contours[lvl] = new_clist(lvl);
|
||||||
if(!contours[lvl]){
|
if(!contours[lvl]){
|
||||||
|
|||||||
BIN
src/fitsview
BIN
src/fitsview
Binary file not shown.
@ -636,3 +636,58 @@ void filter_image( Window *window,
|
|||||||
force_redraw(window->drawingArea);
|
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 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 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 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 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);
|
EXTERN int GradFilterSimple(float *ima, float **result, Filter *f, int sizex, int sizey);
|
||||||
#endif // _CUTOOLS_H_
|
#endif // _CUTOOLS_H_
|
||||||
|
|||||||
@ -16,4 +16,5 @@ void get_circles_params(Window *window, IMAGE *ima);
|
|||||||
void hough_lines(Window *window);
|
void hough_lines(Window *window);
|
||||||
void get_houg_line(Window *window, double x, double y, double *phi_, double *R_);
|
void get_houg_line(Window *window, double x, double y, double *phi_, double *R_);
|
||||||
void filter_image(Window *window, Filter *f);
|
void filter_image(Window *window, Filter *f);
|
||||||
|
int fillIsoScale(Filter *f, float **scale, float min, float wd);
|
||||||
#endif // _IMTOOLS_H_
|
#endif // _IMTOOLS_H_
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user