mirror of
https://github.com/eddyem/apogee_control.git
synced 2025-12-06 18:55:11 +03:00
simple relative coordinates when point by mouse (if ROT0, CRPIX1 and CRPIX2 given)
This commit is contained in:
parent
21b870159d
commit
c601c6ac10
3
README
3
README
@ -45,3 +45,6 @@ to calculate simplest CDx_x coefficients user can give parameter ROT0:
|
|||||||
CROTA2 = -ROT0 + PARANGLE - VAL_P
|
CROTA2 = -ROT0 + PARANGLE - VAL_P
|
||||||
- for right-handed > 0 (0..360)
|
- for right-handed > 0 (0..360)
|
||||||
CROTA2 = ROT0 - PARANGLE + VAL_P
|
CROTA2 = ROT0 - PARANGLE + VAL_P
|
||||||
|
|
||||||
|
|
||||||
|
WARNING! Since 4.08.2016 filename prefix should be pointed by -o flag!
|
||||||
|
|||||||
@ -333,7 +333,7 @@ int push_param(){
|
|||||||
|
|
||||||
void write_bta_queue(fitsfile *fp){
|
void write_bta_queue(fitsfile *fp){
|
||||||
#define HISTRY(...) do{CMNT(__VA_ARGS__); WRITEHIST(fp);}while(0)
|
#define HISTRY(...) do{CMNT(__VA_ARGS__); WRITEHIST(fp);}while(0)
|
||||||
if(!bta_queue) return;
|
if(!bta_queue || !fp) return;
|
||||||
BTA_Queue *cur = bta_queue, *ptr;
|
BTA_Queue *cur = bta_queue, *ptr;
|
||||||
BTA_PARAMS *P;
|
BTA_PARAMS *P;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|||||||
12
camtools.c
12
camtools.c
@ -18,7 +18,7 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
* MA 02110-1301, USA.
|
* MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
#include <float.h> // DBL_EPSILON
|
||||||
#include "takepic.h"
|
#include "takepic.h"
|
||||||
#include "camtools.h"
|
#include "camtools.h"
|
||||||
#include "usage.h"
|
#include "usage.h"
|
||||||
@ -168,7 +168,7 @@ int writefits(char *filename, int width, int height, void *data){
|
|||||||
struct tm *tm_starttime;
|
struct tm *tm_starttime;
|
||||||
char buf[80];
|
char buf[80];
|
||||||
time_t savetime = time(NULL);
|
time_t savetime = time(NULL);
|
||||||
fitsfile *fp;
|
fitsfile *fp = NULL;
|
||||||
TRYFITS(fits_create_file, &fp, filename);
|
TRYFITS(fits_create_file, &fp, filename);
|
||||||
TRYFITS(fits_create_img, fp, USHORT_IMG, 2, naxes);
|
TRYFITS(fits_create_img, fp, USHORT_IMG, 2, naxes);
|
||||||
// FILE / Input file original name
|
// FILE / Input file original name
|
||||||
@ -406,12 +406,10 @@ void convert_grayimage(unsigned short *src, GLubyte *dst, int w, int h){
|
|||||||
}
|
}
|
||||||
avr /= (double)S;
|
avr /= (double)S;
|
||||||
wd = max - min;
|
wd = max - min;
|
||||||
avr = (avr - min) / wd; // normal average by preview
|
if(wd > DBL_EPSILON) avr = (avr - min) / wd; // normal average by preview
|
||||||
DBG("stat: avr=%f wd=%f max=%f min=%f", avr, wd, max, min);
|
|
||||||
// avr = -log(avr); // scale factor
|
|
||||||
// if(avr > 1.) wd /= avr;
|
|
||||||
if(avr < 0.6) wd *= avr + 0.2;
|
if(avr < 0.6) wd *= avr + 0.2;
|
||||||
DBG("now wd is %f", wd);
|
if(wd < DBL_EPSILON) wd = 1.;
|
||||||
|
DBG("stat: sz=(%dx%d) avr=%g wd=%g max=%g min=%g", w,h,avr, wd, max, min);
|
||||||
for(y = 0; y < h; y++){
|
for(y = 0; y < h; y++){
|
||||||
for(x = 0; x < w; x++, dst += 3, src++){
|
for(x = 0; x < w; x++, dst += 3, src++){
|
||||||
gray2rgb(colorfun((*src - min) / wd), dst);
|
gray2rgb(colorfun((*src - min) / wd), dst);
|
||||||
|
|||||||
18
defhdrs.c
18
defhdrs.c
@ -122,9 +122,9 @@ KeyList *list_add_record(KeyList **list, char *rec, int immutable){
|
|||||||
if((node = (KeyList*) MALLOC(KeyList, 1)) == 0) return NULL; // allocation error
|
if((node = (KeyList*) MALLOC(KeyList, 1)) == 0) return NULL; // allocation error
|
||||||
node->record = strdup(rec); // insert data
|
node->record = strdup(rec); // insert data
|
||||||
node->immutable = immutable;
|
node->immutable = immutable;
|
||||||
DBG("add record %s", rec);
|
//DBG("add record %s", rec);
|
||||||
if(!node->record){
|
if(!node->record){
|
||||||
/// "Не могу скопировать данные"
|
/// "îÅ ÍÏÇÕ ÓËÏÐÉÒÏ×ÁÔØ ÄÁÎÎÙÅ"
|
||||||
WARNX(_("Can't copy data"));
|
WARNX(_("Can't copy data"));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -329,6 +329,7 @@ void write_list(fitsfile *fp){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int wcs_rdy = 0;
|
||||||
/**
|
/**
|
||||||
* Check if user tell some information about WCS and add it into headers
|
* Check if user tell some information about WCS and add it into headers
|
||||||
*/
|
*/
|
||||||
@ -350,8 +351,8 @@ void check_wcs(){
|
|||||||
cnt += getdoubleval(&cd, FITS_keys, "CD1_1");
|
cnt += getdoubleval(&cd, FITS_keys, "CD1_1");
|
||||||
cnt += getdoubleval(&crot, FITS_keys, "CROTA2");
|
cnt += getdoubleval(&crot, FITS_keys, "CROTA2");
|
||||||
cnt += getdoubleval(&rot0, FITS_keys, "ROT0");
|
cnt += getdoubleval(&rot0, FITS_keys, "ROT0");
|
||||||
DBG("cnt = %d", cnt);
|
|
||||||
if(!cnt) return;
|
if(!cnt) return;
|
||||||
|
wcs_rdy = 1;
|
||||||
int wcs = 2;
|
int wcs = 2;
|
||||||
WRITEKEY(TINT, "WCSAXIS", &wcs, "Number of WCS axes");
|
WRITEKEY(TINT, "WCSAXIS", &wcs, "Number of WCS axes");
|
||||||
WRITEKEY(TSTRING, "CTYPE1", "RA---TAN", "RA-Gnomic projection");
|
WRITEKEY(TSTRING, "CTYPE1", "RA---TAN", "RA-Gnomic projection");
|
||||||
@ -418,7 +419,6 @@ void check_wcs(){
|
|||||||
double s, c, scx = imscale / 3600. * hbin, scy = imscale / 3600. * vbin;
|
double s, c, scx = imscale / 3600. * hbin, scy = imscale / 3600. * vbin;
|
||||||
if(rot0 < 0){ // left-handed
|
if(rot0 < 0){ // left-handed
|
||||||
crot = (-rot0 + parangle - rotangle)*M_PI/180;
|
crot = (-rot0 + parangle - rotangle)*M_PI/180;
|
||||||
DBG("crot = %g", crot*180/M_PI);
|
|
||||||
sincos(crot, &s, &c);
|
sincos(crot, &s, &c);
|
||||||
CD[0][0] = -scx * c; CD[0][1] = scy * s;
|
CD[0][0] = -scx * c; CD[0][1] = scy * s;
|
||||||
CD[1][0] = scx * s; CD[1][1] = scy * c;
|
CD[1][0] = scx * s; CD[1][1] = scy * c;
|
||||||
@ -433,3 +433,13 @@ void check_wcs(){
|
|||||||
WRITEKEY(TDOUBLE, "CD2_1", &CD[1][0], "rotation matrix coefficient [2,1]");
|
WRITEKEY(TDOUBLE, "CD2_1", &CD[1][0], "rotation matrix coefficient [2,1]");
|
||||||
WRITEKEY(TDOUBLE, "CD2_2", &CD[1][1], "rotation matrix coefficient [2,2]");
|
WRITEKEY(TDOUBLE, "CD2_2", &CD[1][1], "rotation matrix coefficient [2,2]");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// function for events.c - recalculate coordinates on image into WCS
|
||||||
|
void calc_coords(float x, float y, double *alpha, double *delta){
|
||||||
|
double ra, dec, dx = x - crpix1, dy = y - crpix2;
|
||||||
|
if(!wcs_rdy){*alpha = 5e6; *delta = 5e6; return; }
|
||||||
|
ra = crval1 + dx * CD[0][0] + dy * CD[0][1];
|
||||||
|
dec = crval2 + dx * CD[1][0] + dy * CD[1][1];
|
||||||
|
if(alpha) *alpha = ra * 3600.; // hrsec
|
||||||
|
if(delta) *delta = dec * 3600.; // arcsec
|
||||||
|
}
|
||||||
|
|||||||
@ -37,6 +37,8 @@ void processKeybrd(unsigned char key, int mod, int win_GL_ID, _U_ int x, _U_ int
|
|||||||
case 27:
|
case 27:
|
||||||
destroyWindow_async(win_GL_ID);
|
destroyWindow_async(win_GL_ID);
|
||||||
break;
|
break;
|
||||||
|
/* case 'x':
|
||||||
|
break;*/
|
||||||
case 'Z':
|
case 'Z':
|
||||||
win->zoom *= 1.1;
|
win->zoom *= 1.1;
|
||||||
calc_win_props(win, NULL, NULL);
|
calc_win_props(win, NULL, NULL);
|
||||||
@ -67,6 +69,11 @@ void keySpPressed(_U_ int key, _U_ int x, _U_ int y){
|
|||||||
DBG("Sp. key pressed. mod=%d, keycode=%d, point=(%d,%d)\n", glutGetModifiers(), key, x,y);
|
DBG("Sp. key pressed. mod=%d, keycode=%d, point=(%d,%d)\n", glutGetModifiers(), key, x,y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// in defhdrs.c
|
||||||
|
extern void calc_coords(float x, float y, double *alpha, double *delta);
|
||||||
|
extern char *time_asc(double t);
|
||||||
|
extern char *angle_asc(double a);
|
||||||
|
|
||||||
int oldx, oldy; // coordinates when mouse was pressed
|
int oldx, oldy; // coordinates when mouse was pressed
|
||||||
int movingwin = 0; // ==1 when user moves image by middle button
|
int movingwin = 0; // ==1 when user moves image by middle button
|
||||||
void mousePressed(_U_ int key, _U_ int state, _U_ int x, _U_ int y){
|
void mousePressed(_U_ int key, _U_ int state, _U_ int x, _U_ int y){
|
||||||
@ -78,8 +85,16 @@ void mousePressed(_U_ int key, _U_ int state, _U_ int x, _U_ int y){
|
|||||||
if(state == GLUT_DOWN){
|
if(state == GLUT_DOWN){
|
||||||
oldx = x; oldy = y;
|
oldx = x; oldy = y;
|
||||||
float X,Y;
|
float X,Y;
|
||||||
|
double RA, D;
|
||||||
conv_mouse_to_image_coords(x,y,&X,&Y,win);
|
conv_mouse_to_image_coords(x,y,&X,&Y,win);
|
||||||
DBG("press in (%d, %d) == (%f, %f) on image; mod == %d", x,y,X,Y, mod);
|
DBG("press in (%d, %d) == (%f, %f) on image; mod == %d", x,y,X,Y, mod);
|
||||||
|
calc_coords(X, Y, &RA, &D);
|
||||||
|
printf("x = %f, y= %f", X, Y);
|
||||||
|
/// "úÁÄÁÊÔÅ WCS ÐÁÒÁÍÅÔÒÙ, ÐÏ ËÒÁÊÎÅÊ ÍÅÒÅ ROT0, CRPIX1 É CRPIX2"
|
||||||
|
if(RA > 4e6){
|
||||||
|
printf("\n");
|
||||||
|
WARNX(_("Give WCS parameters, at least ROT0, CRPIX1 and CRPIX2"));
|
||||||
|
}else printf(", ra = %s, dec=%s\n", angle_asc(RA), time_asc(D));
|
||||||
if(key == GLUT_MIDDLE_BUTTON) movingwin = 1;
|
if(key == GLUT_MIDDLE_BUTTON) movingwin = 1;
|
||||||
if(key == 3){ // wheel UP
|
if(key == 3){ // wheel UP
|
||||||
if(mod == 0) win->y += 10.*win->zoom; // nothing pressed - scroll up
|
if(mod == 0) win->y += 10.*win->zoom; // nothing pressed - scroll up
|
||||||
@ -94,46 +109,19 @@ void mousePressed(_U_ int key, _U_ int state, _U_ int x, _U_ int y){
|
|||||||
}else{
|
}else{
|
||||||
movingwin = 0;
|
movingwin = 0;
|
||||||
}
|
}
|
||||||
/* DBG("Mouse button %s. point=(%d, %d); mod=%d, button=%d\n",
|
}
|
||||||
(state == GLUT_DOWN)? "pressed":"released", x, y, glutGetModifiers(), key);*/
|
|
||||||
|
|
||||||
/* int window = glutGetWindow();
|
|
||||||
if(window == WaveWindow){ // ÝÅÌËÎÕÌÉ × ÏËÎÅ Ó ×ÅÊ×ÌÅÔÏÍ
|
|
||||||
_U_ int w = glutGet(GLUT_WINDOW_WIDTH) / 2;
|
|
||||||
_U_ int h = glutGet(GLUT_WINDOW_HEIGHT) / 2;
|
|
||||||
if(state == GLUT_DOWN && key == GLUT_LEFT_BUTTON){
|
|
||||||
//HistCoord[0] = (x > w);
|
|
||||||
//HistCoord[1] = (y > h);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
/* this doesn't work
|
|
||||||
void mouseWheel(int button, int dir, int x, int y){
|
|
||||||
int window = glutGetWindow();
|
|
||||||
windowData *win = searchWindow_byGLID(window);
|
|
||||||
if(!win) return;
|
|
||||||
DBG("Mouse wheel, dir: %d. point=(%d, %d); mod=%d, button=%d\n",
|
|
||||||
dir, x, y, glutGetModifiers(), button);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
void mouseMove(_U_ int x, _U_ int y){
|
void mouseMove(_U_ int x, _U_ int y){
|
||||||
int window = glutGetWindow();
|
int window = glutGetWindow();
|
||||||
windowData *win = searchWindow_byGLID(window);
|
windowData *win = searchWindow_byGLID(window);
|
||||||
if(!win) return;
|
if(!win) return;
|
||||||
//DBG("Mouse moved to (%d, %d)\n", x, y);
|
|
||||||
if(movingwin){
|
if(movingwin){
|
||||||
float X, Y, nx, ny;//, w2, h2;
|
float X, Y, nx, ny;
|
||||||
float a = win->Daspect;
|
float a = win->Daspect;
|
||||||
X = (x - oldx) * a; Y = (y - oldy) * a;
|
X = (x - oldx) * a; Y = (y - oldy) * a;
|
||||||
nx = win->x + X;
|
nx = win->x + X;
|
||||||
ny = win->y - Y;
|
ny = win->y - Y;
|
||||||
// w2 = win->image->w / 2. * win->zoom;
|
|
||||||
// h2 = win->image->h / 2. * win->zoom;
|
|
||||||
|
|
||||||
// if(nx < w2 && nx > -w2)
|
|
||||||
win->x = nx;
|
win->x = nx;
|
||||||
// if(ny < h2 && ny > -h2)
|
|
||||||
win->y = ny;
|
win->y = ny;
|
||||||
oldx = x;
|
oldx = x;
|
||||||
oldy = y;
|
oldy = y;
|
||||||
@ -162,6 +150,7 @@ void createMenu(int GL_ID){
|
|||||||
glutAddMenuEntry("Quit (ctrl+q)", 'q');
|
glutAddMenuEntry("Quit (ctrl+q)", 'q');
|
||||||
glutAddMenuEntry("Close this window (ESC)", 27);
|
glutAddMenuEntry("Close this window (ESC)", 27);
|
||||||
glutAddMenuEntry("Restore zoom (1)", '1');
|
glutAddMenuEntry("Restore zoom (1)", '1');
|
||||||
|
// glutAddMenuEntry("Make exposition (x)", 'x');
|
||||||
glutAttachMenu(GLUT_RIGHT_BUTTON);
|
glutAttachMenu(GLUT_RIGHT_BUTTON);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -37,6 +37,5 @@ void mousePressed(int key, int state, int x, int y);
|
|||||||
void mouseMove(int x, int y);
|
void mouseMove(int x, int y);
|
||||||
void createMenu(int window);
|
void createMenu(int window);
|
||||||
void menuEvents(int opt);
|
void menuEvents(int opt);
|
||||||
//void mouseWheel(int button, int dir, int x, int y);
|
|
||||||
|
|
||||||
#endif // __EVENTS_H__
|
#endif // __EVENTS_H__
|
||||||
|
|||||||
@ -80,28 +80,20 @@ void createWindow(windowData *win){
|
|||||||
glutDisplayFunc(RedrawWindow);
|
glutDisplayFunc(RedrawWindow);
|
||||||
glutKeyboardFunc(keyPressed);
|
glutKeyboardFunc(keyPressed);
|
||||||
glutSpecialFunc(keySpPressed);
|
glutSpecialFunc(keySpPressed);
|
||||||
//glutMouseWheelFunc(mouseWheel);
|
|
||||||
glutMouseFunc(mousePressed);
|
glutMouseFunc(mousePressed);
|
||||||
glutMotionFunc(mouseMove);
|
glutMotionFunc(mouseMove);
|
||||||
//glutIdleFunc(glutPostRedisplay);
|
|
||||||
glutIdleFunc(NULL);
|
glutIdleFunc(NULL);
|
||||||
DBG("init textures");
|
DBG("init textures");
|
||||||
glGenTextures(1, &(win->Tex));
|
glGenTextures(1, &(win->Tex));
|
||||||
win->zoom = 1.;
|
win->zoom = 1.;
|
||||||
// calc_win_props(win, NULL, NULL);
|
|
||||||
// win->zoom = 1. / win->Daspect;
|
|
||||||
// DBG("Daspect: %g, zoom: %g", win->Daspect, win->zoom);
|
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
glBindTexture(GL_TEXTURE_2D, win->Tex);
|
glBindTexture(GL_TEXTURE_2D, win->Tex);
|
||||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||||
// glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
|
||||||
// glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
|
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
|
||||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
|
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
|
||||||
|
|
||||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||||
//glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
|
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, win->image->w, win->image->h, 0,
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, win->image->w, win->image->h, 0,
|
||||||
GL_RGB, GL_UNSIGNED_BYTE, win->image->rawdata);
|
GL_RGB, GL_UNSIGNED_BYTE, win->image->rawdata);
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
@ -194,19 +186,6 @@ void redisplay(int GL_ID){
|
|||||||
glutPostRedisplay();
|
glutPostRedisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
if(redraw)
|
|
||||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h,
|
|
||||||
GL_LUMINANCE, GL_FLOAT, ptro); // s/image->data/tex/
|
|
||||||
else
|
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_INTENSITY, w, h,
|
|
||||||
0, GL_LUMINANCE, GL_FLOAT, ptro);
|
|
||||||
//glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
|
|
||||||
//glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
|
|
||||||
*/
|
|
||||||
|
|
||||||
void RedrawWindow(){
|
void RedrawWindow(){
|
||||||
if(!initialized) return;
|
if(!initialized) return;
|
||||||
int window;
|
int window;
|
||||||
@ -218,7 +197,6 @@ void RedrawWindow(){
|
|||||||
glClearColor(0.0, 0.0, 0.0, 1.0);
|
glClearColor(0.0, 0.0, 0.0, 1.0);
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
//glTranslatef(win->x-w/2., win->y-h/2., win->z);
|
|
||||||
glTranslatef(win->x, win->y, 0.);
|
glTranslatef(win->x, win->y, 0.);
|
||||||
glScalef(-win->zoom, -win->zoom, 1.);
|
glScalef(-win->zoom, -win->zoom, 1.);
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
@ -229,14 +207,6 @@ void RedrawWindow(){
|
|||||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, GL_RGB, GL_UNSIGNED_BYTE, win->image->rawdata);
|
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, GL_RGB, GL_UNSIGNED_BYTE, win->image->rawdata);
|
||||||
win->image->changed = 0;
|
win->image->changed = 0;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
glBegin(GL_QUADS);
|
|
||||||
glTexCoord2f(0., 1.); glVertex3f(0., 0., 0.);
|
|
||||||
glTexCoord2f(0., 0.); glVertex3f(0.,h, 0.);
|
|
||||||
glTexCoord2f(1., 0.); glVertex3f(w, h, 0.);
|
|
||||||
glTexCoord2f(1., 1.); glVertex3f(w, 0., 0.);
|
|
||||||
glEnd();
|
|
||||||
*/
|
|
||||||
w /= 2.; h /= 2.;
|
w /= 2.; h /= 2.;
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
glTexCoord2f(0.0f, 0.0f); glVertex2f(-w, -h );
|
glTexCoord2f(0.0f, 0.0f); glVertex2f(-w, -h );
|
||||||
@ -255,10 +225,6 @@ void RedrawWindow(){
|
|||||||
* waits for global signals to create windows & make other actions
|
* waits for global signals to create windows & make other actions
|
||||||
*/
|
*/
|
||||||
void *Redraw(_U_ void *arg){
|
void *Redraw(_U_ void *arg){
|
||||||
// pthread_cond_t fakeCond = PTHREAD_COND_INITIALIZER;
|
|
||||||
// struct timeval tv;
|
|
||||||
// struct timespec timeToWait;
|
|
||||||
// struct timeval now;
|
|
||||||
while(1){
|
while(1){
|
||||||
pthread_mutex_lock(&winini_mutex);
|
pthread_mutex_lock(&winini_mutex);
|
||||||
if(!initialized){
|
if(!initialized){
|
||||||
@ -279,22 +245,8 @@ void *Redraw(_U_ void *arg){
|
|||||||
wannakill_GL_ID = 0;
|
wannakill_GL_ID = 0;
|
||||||
}
|
}
|
||||||
forEachWindow(redisplay);
|
forEachWindow(redisplay);
|
||||||
/* gettimeofday(&now,NULL);
|
|
||||||
timeToWait.tv_sec = now.tv_sec;
|
|
||||||
timeToWait.tv_nsec = now.tv_usec * 1000UL + 10000000UL;
|
|
||||||
pthread_cond_timedwait(&fakeCond, &winini_mutex, &timeToWait);*/
|
|
||||||
pthread_mutex_unlock(&winini_mutex);
|
pthread_mutex_unlock(&winini_mutex);
|
||||||
//pthread_testcancel();
|
|
||||||
if(totWindows) glutMainLoopEvent(); // process actions if there are windows
|
if(totWindows) glutMainLoopEvent(); // process actions if there are windows
|
||||||
/* gettimeofday(&now,NULL);
|
|
||||||
timeToWait.tv_sec = now.tv_sec;
|
|
||||||
timeToWait.tv_nsec = now.tv_usec * 1000UL + 10000000UL;
|
|
||||||
pthread_mutex_lock(&fakeMutex);
|
|
||||||
pthread_cond_timedwait(&fakeCond, &fakeMutex, &timeToWait);
|
|
||||||
pthread_mutex_unlock(&fakeMutex);*/
|
|
||||||
/* tv.tv_sec = 0;
|
|
||||||
tv.tv_usec = 10000;
|
|
||||||
select(0, NULL, NULL, NULL, &tv);*/
|
|
||||||
usleep(10000);
|
usleep(10000);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -305,22 +257,15 @@ void Resize(int width, int height){
|
|||||||
int window = glutGetWindow();
|
int window = glutGetWindow();
|
||||||
windowData *win = searchWindow_byGLID(window);
|
windowData *win = searchWindow_byGLID(window);
|
||||||
if(!win) return;
|
if(!win) return;
|
||||||
/* int GRAB_WIDTH = win->w, GRAB_HEIGHT = win->h;
|
|
||||||
float _U_ tmp, wd = (float) width/GRAB_WIDTH, ht = (float)height/GRAB_HEIGHT;
|
|
||||||
tmp = (wd + ht) / 2.;
|
|
||||||
width = (int)(tmp * GRAB_WIDTH); height = (int)(tmp * GRAB_HEIGHT);*/
|
|
||||||
glutReshapeWindow(width, height);
|
glutReshapeWindow(width, height);
|
||||||
win->w = width;
|
win->w = width;
|
||||||
win->h = height;
|
win->h = height;
|
||||||
glViewport(0, 0, width, height);
|
glViewport(0, 0, width, height);
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
//GLfloat W = (GLfloat)GRAB_WIDTH; GLfloat H = (GLfloat)GRAB_HEIGHT;
|
|
||||||
GLfloat W, H;
|
GLfloat W, H;
|
||||||
calc_win_props(win, &W, &H);
|
calc_win_props(win, &W, &H);
|
||||||
glOrtho(-W,W, -H,H, -1., 1.);
|
glOrtho(-W,W, -H,H, -1., 1.);
|
||||||
// gluPerspective(90., W/H, 0., 100.0);
|
|
||||||
// gluLookAt(0., 0., H/2., 0., 0., 0., 0., 1., 0.);
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
}
|
}
|
||||||
@ -389,11 +334,12 @@ void imageview_init(){
|
|||||||
int c = 1;
|
int c = 1;
|
||||||
static int glutnotinited = 1;
|
static int glutnotinited = 1;
|
||||||
if(initialized){
|
if(initialized){
|
||||||
// "Уже инициализировано!"
|
// "õÖÅ ÉÎÉÃÉÁÌÉÚÉÒÏ×ÁÎÏ!"
|
||||||
WARNX(_("Already initialized!"));
|
WARNX(_("Already initialized!"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(glutnotinited){
|
if(glutnotinited){
|
||||||
|
DBG("init");
|
||||||
XInitThreads(); // we need it for threaded windows
|
XInitThreads(); // we need it for threaded windows
|
||||||
glutInit(&c, v);
|
glutInit(&c, v);
|
||||||
glutnotinited = 0;
|
glutnotinited = 0;
|
||||||
@ -419,12 +365,10 @@ void clear_GL_context(){
|
|||||||
initialized = 0;
|
initialized = 0;
|
||||||
DBG("locked");
|
DBG("locked");
|
||||||
// kill main GLUT thread
|
// kill main GLUT thread
|
||||||
// pthread_cancel(GLUTthread);
|
|
||||||
pthread_mutex_unlock(&winini_mutex);
|
pthread_mutex_unlock(&winini_mutex);
|
||||||
forEachWindow(killwindow_v);
|
forEachWindow(killwindow_v);
|
||||||
DBG("join");
|
DBG("join");
|
||||||
pthread_join(GLUTthread, NULL); // wait while main thread exits
|
pthread_join(GLUTthread, NULL); // wait while main thread exits
|
||||||
// pthread_mutex_unlock(&winini_mutex);
|
|
||||||
DBG("main GL thread cancelled");
|
DBG("main GL thread cancelled");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
69
takepic.c
69
takepic.c
@ -285,7 +285,7 @@ wheelret:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef IMAGEVIEW
|
#ifdef IMAGEVIEW
|
||||||
void change_displayed_image(_U_ unsigned short *buf, windowData *win){
|
void change_displayed_image(unsigned short *buf, windowData *win){
|
||||||
FNAME();
|
FNAME();
|
||||||
if(!win) return;
|
if(!win) return;
|
||||||
pthread_mutex_lock(&win->mutex);
|
pthread_mutex_lock(&win->mutex);
|
||||||
@ -307,23 +307,15 @@ int main(int argc, char **argv){
|
|||||||
FILE *f_statlog = NULL; // stat file
|
FILE *f_statlog = NULL; // stat file
|
||||||
int roih=0, roiw=0, osh=0, osw=0, binh=0, binw=0, shtr=0; // camera parameters
|
int roih=0, roiw=0, osh=0, osw=0, binh=0, binw=0, shtr=0; // camera parameters
|
||||||
char whynot[BUFF_SIZ]; // temporary buffer for error texts
|
char whynot[BUFF_SIZ]; // temporary buffer for error texts
|
||||||
int imW=0, imH=0; // real (with binning) image size
|
int imW=1024, imH=1024; // real (with binning) image size
|
||||||
unsigned short *buf = NULL; // image buffer
|
unsigned short *buf = NULL; // image buffer
|
||||||
double mintemp=0.;
|
double mintemp=0.;
|
||||||
#ifdef IMAGEVIEW
|
#ifdef IMAGEVIEW
|
||||||
_U_ windowData *mainwin = NULL;
|
windowData *mainwin = NULL;
|
||||||
_U_ rawimage im;
|
rawimage im;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
initial_setup(); // setup for macros.c
|
initial_setup(); // setup for macros.c
|
||||||
//setlocale(LC_ALL, getenv("LC_ALL"));
|
|
||||||
/* setlocale(LC_ALL, "");
|
|
||||||
setlocale(LC_NUMERIC, "C");
|
|
||||||
bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
|
|
||||||
//bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
|
|
||||||
textdomain(GETTEXT_PACKAGE);
|
|
||||||
*/
|
|
||||||
|
|
||||||
parse_args(argc, argv);
|
parse_args(argc, argv);
|
||||||
|
|
||||||
catch_signals();
|
catch_signals();
|
||||||
@ -334,7 +326,9 @@ int main(int argc, char **argv){
|
|||||||
writefits(NULL, imW, imH, NULL);
|
writefits(NULL, imW, imH, NULL);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
if(fake) test_headers = 1;
|
||||||
|
// Begin of non-fake block ------->
|
||||||
|
if(!fake){
|
||||||
// Turret block
|
// Turret block
|
||||||
if(open_turret) parse_turret_args();
|
if(open_turret) parse_turret_args();
|
||||||
if(only_turret){
|
if(only_turret){
|
||||||
@ -515,6 +509,7 @@ DBG("open %d", Ncam);
|
|||||||
ERR("Can't set readout parameters: %s", whynot);
|
ERR("Can't set readout parameters: %s", whynot);
|
||||||
goto returning;
|
goto returning;
|
||||||
}
|
}
|
||||||
|
} // <------ end of non-fake block
|
||||||
DBG("geomery: %dx%d", imW, imH);
|
DBG("geomery: %dx%d", imW, imH);
|
||||||
int L = imW*imH;
|
int L = imW*imH;
|
||||||
buf = (unsigned short*) calloc(L, sizeof(unsigned short));
|
buf = (unsigned short*) calloc(L, sizeof(unsigned short));
|
||||||
@ -524,7 +519,7 @@ DBG("open %d", Ncam);
|
|||||||
}
|
}
|
||||||
#ifdef IMAGEVIEW
|
#ifdef IMAGEVIEW
|
||||||
// start image view module if not need to save image or manually defined displaying
|
// start image view module if not need to save image or manually defined displaying
|
||||||
if(!save_image || show_image){
|
if(fake || !save_image || show_image){
|
||||||
imageview_init();
|
imageview_init();
|
||||||
im.protected = 1;
|
im.protected = 1;
|
||||||
im.rawdata = MALLOC(GLubyte, imW*imH*3);
|
im.rawdata = MALLOC(GLubyte, imW*imH*3);
|
||||||
@ -532,6 +527,7 @@ DBG("open %d", Ncam);
|
|||||||
im.w = imW; im.h = imH;
|
im.w = imW; im.h = imH;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
if(fake) pics = 0;
|
||||||
DBG("start %d expositions", pics);
|
DBG("start %d expositions", pics);
|
||||||
for (i = 0; i < pics; i++){
|
for (i = 0; i < pics; i++){
|
||||||
DBG("spd");
|
DBG("spd");
|
||||||
@ -627,18 +623,13 @@ DBG("open %d", Ncam);
|
|||||||
fprintf(f_statlog, "%s\t%ld\t%g\t%.2f\t%.2f\t", tm_buf,
|
fprintf(f_statlog, "%s\t%ld\t%g\t%.2f\t%.2f\t", tm_buf,
|
||||||
time(NULL), E, t_int, t_ext);
|
time(NULL), E, t_int, t_ext);
|
||||||
print_stat(buf, L, f_statlog);
|
print_stat(buf, L, f_statlog);
|
||||||
inline void WRITEIMG(int (*writefn)(char*,int,int,void*), char *ext){
|
|
||||||
if(!check_filename(whynot, outfile, ext))
|
|
||||||
// "îÅ ÍÏÇÕ ÓÏÈÒÁÎÉÔØ ÆÁÊÌ"
|
|
||||||
err(1, _("Can't save file"));
|
|
||||||
else{
|
|
||||||
int r = writefn(whynot, imW, imH, buf);
|
|
||||||
// "æÁÊÌ ÚÁÐÉÓÁÎ × '%s'"
|
|
||||||
if (r == 0) info(_("File saved as '%s'"), whynot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#ifdef IMAGEVIEW
|
#ifdef IMAGEVIEW
|
||||||
if(!save_image || show_image){
|
if(!save_image || show_image){
|
||||||
|
// build FITS headers tree for viewer
|
||||||
|
#ifdef USE_BTA
|
||||||
|
write_bta_data(NULL);
|
||||||
|
#endif
|
||||||
|
check_wcs();
|
||||||
if(!get_windows_amount() || !mainwin){
|
if(!get_windows_amount() || !mainwin){
|
||||||
mainwin = createGLwin("Sample window", 400, 400, &im);
|
mainwin = createGLwin("Sample window", 400, 400, &im);
|
||||||
if(!mainwin){
|
if(!mainwin){
|
||||||
@ -654,6 +645,16 @@ DBG("open %d", Ncam);
|
|||||||
change_displayed_image(buf, mainwin);
|
change_displayed_image(buf, mainwin);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
inline void WRITEIMG(int (*writefn)(char*,int,int,void*), char *ext){
|
||||||
|
if(!check_filename(whynot, outfile, ext))
|
||||||
|
// "îÅ ÍÏÇÕ ÓÏÈÒÁÎÉÔØ ÆÁÊÌ"
|
||||||
|
err(1, _("Can't save file"));
|
||||||
|
else{
|
||||||
|
int r = writefn(whynot, imW, imH, buf);
|
||||||
|
// "æÁÊÌ ÚÁÐÉÓÁÎ × '%s'"
|
||||||
|
if (r == 0) info(_("File saved as '%s'"), whynot);
|
||||||
|
}
|
||||||
|
}
|
||||||
if(save_image){
|
if(save_image){
|
||||||
DBG("save image");
|
DBG("save image");
|
||||||
#ifdef USERAW
|
#ifdef USERAW
|
||||||
@ -682,8 +683,27 @@ DBG("open %d", Ncam);
|
|||||||
}
|
}
|
||||||
fflush(NULL);
|
fflush(NULL);
|
||||||
}
|
}
|
||||||
|
#ifdef IMAGEVIEW
|
||||||
|
if(fake){
|
||||||
|
writefits(NULL, imW, imH, NULL);
|
||||||
|
if(!get_windows_amount() || !mainwin){
|
||||||
|
mainwin = createGLwin("Sample window", 400, 400, &im);
|
||||||
|
if(!mainwin){
|
||||||
|
// "îÅ ÍÏÇÕ ÏÔËÒÙÔØ ÏËÎÏ OpenGL, ÐÒÏÓÍÏÔÒ ÂÕÄÅÔ ÎÅÄÏÓÔÕÐÅÎ!"
|
||||||
|
info(_("Can't open OpenGL window, image preview will be inaccessible"));
|
||||||
|
}else{
|
||||||
|
mainwin->killthread = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(get_windows_amount() && mainwin){
|
||||||
|
DBG("change image");
|
||||||
|
change_displayed_image(buf, mainwin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
returning:
|
returning:
|
||||||
if(!only_turret){
|
if(!only_turret){
|
||||||
|
if(!fake){
|
||||||
// set fan speed to 0 or 3 according cooler status
|
// set fan speed to 0 or 3 according cooler status
|
||||||
AutoadjustFanSpeed(TRUE);
|
AutoadjustFanSpeed(TRUE);
|
||||||
DBG("abort exp");
|
DBG("abort exp");
|
||||||
@ -696,6 +716,7 @@ returning:
|
|||||||
free_fits_list();
|
free_fits_list();
|
||||||
if(f_tlog) fclose(f_tlog);
|
if(f_tlog) fclose(f_tlog);
|
||||||
if(f_statlog) fclose(f_statlog);
|
if(f_statlog) fclose(f_statlog);
|
||||||
|
}
|
||||||
#ifdef IMAGEVIEW
|
#ifdef IMAGEVIEW
|
||||||
DBG("test for GL window");
|
DBG("test for GL window");
|
||||||
if(mainwin){ //window was created - wait for manual close
|
if(mainwin){ //window was created - wait for manual close
|
||||||
|
|||||||
95
usage.c
95
usage.c
@ -63,6 +63,7 @@ int
|
|||||||
,Shtr = -1 // shutter: -1 -- no action or SHUTTER_OPEN/SHUTTER_CLOSE
|
,Shtr = -1 // shutter: -1 -- no action or SHUTTER_OPEN/SHUTTER_CLOSE
|
||||||
,noclean = 0 // don't flush camera after exp
|
,noclean = 0 // don't flush camera after exp
|
||||||
,twelveBit = 0 // 12-bit ADC
|
,twelveBit = 0 // 12-bit ADC
|
||||||
|
,fake = 0 // fake image
|
||||||
,flipX = 0 // flip image around X axe (vertical flip)
|
,flipX = 0 // flip image around X axe (vertical flip)
|
||||||
,flipY = 0 // flip image around Y axe (horizontal flip)
|
,flipY = 0 // flip image around Y axe (horizontal flip)
|
||||||
,histry = 0 // write history at expositions
|
,histry = 0 // write history at expositions
|
||||||
@ -141,6 +142,9 @@ void usage(char *fmt, ...){
|
|||||||
printf("\t-b,\t--defhdr=filename\t%s\n",
|
printf("\t-b,\t--defhdr=filename\t%s\n",
|
||||||
// "ÉÍÑ ÆÁÊÌÁ Ó ÚÁÇÏÌÏ×ËÁÍÉ ÐÏ ÕÍÏÌÞÁÎÉÀ"
|
// "ÉÍÑ ÆÁÊÌÁ Ó ÚÁÇÏÌÏ×ËÁÍÉ ÐÏ ÕÍÏÌÞÁÎÉÀ"
|
||||||
_("file with default headers"));
|
_("file with default headers"));
|
||||||
|
printf("\t-B,\t--observer=obs\t\t%s\n",
|
||||||
|
// "ÉÍÅÎÁ ÎÁÂÌÀÄÁÔÅÌÅÊ"
|
||||||
|
_("observers' names"));
|
||||||
printf("\t-c,\t--cooler-off\t\t%s\n",
|
printf("\t-c,\t--cooler-off\t\t%s\n",
|
||||||
// "ÏÔËÌÀÞÉÔØ ÈÏÌÏÄÉÌØÎÉË"
|
// "ÏÔËÌÀÞÉÔØ ÈÏÌÏÄÉÌØÎÉË"
|
||||||
_("set cooler off"));
|
_("set cooler off"));
|
||||||
@ -168,63 +172,63 @@ void usage(char *fmt, ...){
|
|||||||
printf("\t-G,\t--wheel-go=N\t\t%s\n",
|
printf("\t-G,\t--wheel-go=N\t\t%s\n",
|
||||||
// ÐÅÒÅÍÅÓÔÉÔØ ÔÕÒÅÌØ × N-À ÐÏÚÉÃÉÀ
|
// ÐÅÒÅÍÅÓÔÉÔØ ÔÕÒÅÌØ × N-À ÐÏÚÉÃÉÀ
|
||||||
_("set turret to Nth position"));
|
_("set turret to Nth position"));
|
||||||
printf("\t-H,\t--time-interval=T\t%s\n",
|
|
||||||
// "ÉÎÔÅÒ×ÁÌ ×ÒÅÍÅÎÉ ÍÅÖÄÕ ÐÏÓÌÅÄÏ×ÁÔÅÌØÎÙÍÉ ÚÁÐÉÓÑÍÉ × ÌÏÇ É HISTORY (× ÓÅËÕÎÄÁÈ)"
|
|
||||||
_("time interval between sequential writings to log & HISTORY (in seconds)"));
|
|
||||||
printf("\t-h,\t--hbin=N\t\t%s\n",
|
printf("\t-h,\t--hbin=N\t\t%s\n",
|
||||||
// "ÂÉÎÎÉÎÇ N ÐÉËÓÅÌÅÊ ÐÏ ÇÏÒÉÚÏÎÔÁÌÉ"
|
// "ÂÉÎÎÉÎÇ N ÐÉËÓÅÌÅÊ ÐÏ ÇÏÒÉÚÏÎÔÁÌÉ"
|
||||||
_("horizontal binning to N pixels"));
|
_("horizontal binning to N pixels"));
|
||||||
printf("\t-I,\t--image-type=type\t%s\n",
|
printf("\t-H,\t--time-interval=T\t%s\n",
|
||||||
// "ÔÉÐ ÉÚÏÂÒÁÖÅÎÉÑ"
|
// "ÉÎÔÅÒ×ÁÌ ×ÒÅÍÅÎÉ ÍÅÖÄÕ ÐÏÓÌÅÄÏ×ÁÔÅÌØÎÙÍÉ ÚÁÐÉÓÑÍÉ × ÌÏÇ É HISTORY (× ÓÅËÕÎÄÁÈ)"
|
||||||
_("image type"));
|
_("time interval between sequential writings to log & HISTORY (in seconds)"));
|
||||||
printf("\t-i,\t--instrument=instr\t%s\n",
|
printf("\t-i,\t--instrument=instr\t%s\n",
|
||||||
// "ÎÁÚ×ÁÎÉÅ ÐÒÉÂÏÒÁ"
|
// "ÎÁÚ×ÁÎÉÅ ÐÒÉÂÏÒÁ"
|
||||||
_("instrument name"));
|
_("instrument name"));
|
||||||
printf("\t-L,\t--log-only\t\t%s\n",
|
printf("\t-I,\t--image-type=type\t%s\n",
|
||||||
// "ÎÅ ÓÏÈÒÁÎÑÔØ ÉÚÏÂÒÁÖÅÎÉÑ, ÌÉÛØ ×ÅÓÔÉ ÚÁÐÉÓØ ÓÔÁÔÉÓÔËÉ"
|
// "ÔÉÐ ÉÚÏÂÒÁÖÅÎÉÑ"
|
||||||
_("don't save images, only make all-stat log"));
|
_("image type"));
|
||||||
printf("\t-l,\t--tlog\t\t\t%s\n",
|
printf("\t-l,\t--tlog\t\t\t%s\n",
|
||||||
// "×ÅÓÔÉ ÚÁÐÉÓØ ÒÁÂÏÞÉÈ ÔÅÍÐÅÒÁÔÕÒ × ÆÁÊÌ temp_log"
|
// "×ÅÓÔÉ ÚÁÐÉÓØ ÒÁÂÏÞÉÈ ÔÅÍÐÅÒÁÔÕÒ × ÆÁÊÌ temp_log"
|
||||||
_("make temperatures logging to file temp_log"));
|
_("make temperatures logging to file temp_log"));
|
||||||
|
printf("\t-L,\t--log-only\t\t%s\n",
|
||||||
|
// "ÎÅ ÓÏÈÒÁÎÑÔØ ÉÚÏÂÒÁÖÅÎÉÑ, ÌÉÛØ ×ÅÓÔÉ ÚÁÐÉÓØ ÓÔÁÔÉÓÔËÉ"
|
||||||
|
_("don't save images, only make all-stat log"));
|
||||||
printf("\t-M,\t--msg-id\t\t%s\n",
|
printf("\t-M,\t--msg-id\t\t%s\n",
|
||||||
// "ÏÔËÒÙÔØ ËÁÍÅÒÕ ÐÏ MSG-ID"
|
// "ÏÔËÒÙÔØ ËÁÍÅÒÕ ÐÏ MSG-ID"
|
||||||
_("open camera by its MSG-ID"));
|
_("open camera by its MSG-ID"));
|
||||||
printf("\t-N,\t--ncam=N\t\t%s\n",
|
|
||||||
// "ÒÁÂÏÔÁÔØ Ó N-Ê ËÁÍÅÒÏÊ"
|
|
||||||
_("work with Nth camera"));
|
|
||||||
printf("\t-n,\t--nframes=N\t\t%s\n",
|
printf("\t-n,\t--nframes=N\t\t%s\n",
|
||||||
// "N ËÁÄÒÏ× × ÓÅÒÉÉ"
|
// "N ËÁÄÒÏ× × ÓÅÒÉÉ"
|
||||||
_("make series of N frames"));
|
_("make series of N frames"));
|
||||||
|
printf("\t-N,\t--ncam=N\t\t%s\n",
|
||||||
|
// "ÒÁÂÏÔÁÔØ Ó N-Ê ËÁÍÅÒÏÊ"
|
||||||
|
_("work with Nth camera"));
|
||||||
|
printf("\t-o,\t--outfile=prefix\t%s\n",
|
||||||
|
// "ÐÒÅÆÉËÓ ÉÍÅÎÉ ×ÙÈÏÄÎÏÇÏ ÆÁÊÌÁ"
|
||||||
|
_("output filename prefix"));
|
||||||
printf("\t-O,\t--object=obj\t\t%s\n",
|
printf("\t-O,\t--object=obj\t\t%s\n",
|
||||||
// "ÎÁÚ×ÁÎÉÅ ÏÂßÅËÔÁ"
|
// "ÎÁÚ×ÁÎÉÅ ÏÂßÅËÔÁ"
|
||||||
_("object name"));
|
_("object name"));
|
||||||
printf("\t-o,\t--observer=obs\t\t%s\n",
|
|
||||||
// "ÉÍÅÎÁ ÎÁÂÌÀÄÁÔÅÌÅÊ"
|
|
||||||
_("observers' names"));
|
|
||||||
printf("\t-P,\t--prog-id=prname\t%s\n",
|
|
||||||
// "ÎÁÚ×ÁÎÉÅ ÐÒÏÇÒÁÍÍÙ ÎÁÂÌÀÄÅÎÉÊ"
|
|
||||||
_("observing program name"));
|
|
||||||
printf("\t-p,\t--pause-len=ptime\t%s\n",
|
printf("\t-p,\t--pause-len=ptime\t%s\n",
|
||||||
// "×ÙÄÅÒÖÁÔØ ptime ÓÅËÕÎÄ ÍÅÖÄÕ ÜËÓÐÏÚÉÃÉÑÍÉ"
|
// "×ÙÄÅÒÖÁÔØ ptime ÓÅËÕÎÄ ÍÅÖÄÕ ÜËÓÐÏÚÉÃÉÑÍÉ"
|
||||||
_("make pause for ptime seconds between expositions"));
|
_("make pause for ptime seconds between expositions"));
|
||||||
|
printf("\t-P,\t--prog-id=prname\t%s\n",
|
||||||
|
// "ÎÁÚ×ÁÎÉÅ ÐÒÏÇÒÁÍÍÙ ÎÁÂÌÀÄÅÎÉÊ"
|
||||||
|
_("observing program name"));
|
||||||
printf("\t-r,\t--speed-set=N\t\t%s\n",
|
printf("\t-r,\t--speed-set=N\t\t%s\n",
|
||||||
// "ÕÓÔÁÎÏ×ÉÔØ ÓËÏÒÏÓÔØ ÓÞÉÔÙ×ÁÎÉÑ × N"
|
// "ÕÓÔÁÎÏ×ÉÔØ ÓËÏÒÏÓÔØ ÓÞÉÔÙ×ÁÎÉÑ × N"
|
||||||
_("set readout speed to N"));
|
_("set readout speed to N"));
|
||||||
printf("\t-R,\t--reset\t\t\t%s\n",
|
printf("\t-R,\t--reset\t\t\t%s\n",
|
||||||
// "ðÏÌÎÙÊ ÓÂÒÏÓ"
|
// "ðÏÌÎÙÊ ÓÂÒÏÓ"
|
||||||
_("full reset"));
|
_("full reset"));
|
||||||
printf("\t-S,\t--sleep\t\t\t%s\n",
|
|
||||||
// "ÐÅÒÅÊÔÉ × ÓÐÑÝÉÊ ÒÅÖÉÍ"
|
|
||||||
_("go to sleeping mode"));
|
|
||||||
printf("\t-s,\t--only-stat\t\t%s\n",
|
printf("\t-s,\t--only-stat\t\t%s\n",
|
||||||
// "ÎÅ ÓÏÈÒÁÎÑÔØ ÉÚÏÂÒÁÖÅÎÉÅ, Á ÔÏÌØËÏ ÏÔÏÂÒÁÚÉÔØ ÓÔÁÔÉÓÔÉËÕ"
|
// "ÎÅ ÓÏÈÒÁÎÑÔØ ÉÚÏÂÒÁÖÅÎÉÅ, Á ÔÏÌØËÏ ÏÔÏÂÒÁÚÉÔØ ÓÔÁÔÉÓÔÉËÕ"
|
||||||
_("not save image, just show statistics"));
|
_("not save image, just show statistics"));
|
||||||
printf("\t-T,\t--only-temp\t\t%s\n",
|
printf("\t-S,\t--sleep\t\t\t%s\n",
|
||||||
// "ÔÏÌØËÏ ÚÁÄÁÔØ/ÐÏÌÕÞÉÔØ ÔÅÍÐÅÒÁÔÕÒÕ"
|
// "ÐÅÒÅÊÔÉ × ÓÐÑÝÉÊ ÒÅÖÉÍ"
|
||||||
_("only set/get temperature"));
|
_("go to sleeping mode"));
|
||||||
printf("\t-t,\t--set-temp=degr\t\t%s\n",
|
printf("\t-t,\t--set-temp=degr\t\t%s\n",
|
||||||
// "ÚÁÄÁÔØ ÒÁÂÏÞÕÀ ÔÅÍÐÅÒÁÔÕÒÕ degr ÇÒÁÄÕÓÏ×"
|
// "ÚÁÄÁÔØ ÒÁÂÏÞÕÀ ÔÅÍÐÅÒÁÔÕÒÕ degr ÇÒÁÄÕÓÏ×"
|
||||||
_("set work temperature to degr C"));
|
_("set work temperature to degr C"));
|
||||||
|
printf("\t-T,\t--only-temp\t\t%s\n",
|
||||||
|
// "ÔÏÌØËÏ ÚÁÄÁÔØ/ÐÏÌÕÞÉÔØ ÔÅÍÐÅÒÁÔÕÒÕ"
|
||||||
|
_("only set/get temperature"));
|
||||||
printf("\t-v,\t--vbin=N\t\t%s\n",
|
printf("\t-v,\t--vbin=N\t\t%s\n",
|
||||||
// "ÂÉÎÎÉÎÇ N ÐÉËÓÅÌÅÊ ÐÏ ×ÅÒÔÉËÁÌÉ"
|
// "ÂÉÎÎÉÎÇ N ÐÉËÓÅÌÅÊ ÐÏ ×ÅÒÔÉËÁÌÉ"
|
||||||
_("vertical binning to N pixels"));
|
_("vertical binning to N pixels"));
|
||||||
@ -244,6 +248,9 @@ void usage(char *fmt, ...){
|
|||||||
// "×ÙÂÒÁÔØ ÄÉÁÐÁÚÏÎ ÄÌÑ ÓÞÉÔÙ×ÁÎÉÑ"
|
// "×ÙÂÒÁÔØ ÄÉÁÐÁÚÏÎ ÄÌÑ ÓÞÉÔÙ×ÁÎÉÑ"
|
||||||
_("select clip region"));
|
_("select clip region"));
|
||||||
// ONLY LONG
|
// ONLY LONG
|
||||||
|
printf("\t\t--fakeimg\t\t\t%s\n",
|
||||||
|
// "ôÅÓÔ ÏËÎÁ OpenGL ÂÅÚ ÐÏÌÕÞÅÎÉÑ ÉÚÏÂÒÁÖÅÎÉÑ"
|
||||||
|
_("Test OpenGL window (without image exposure)"));
|
||||||
printf("\t\t--flipX\t\t\t%s\n",
|
printf("\t\t--flipX\t\t\t%s\n",
|
||||||
// "ÏÔÒÁÚÉÔØ ÉÚÏÂÒÁÖÅÎÉÅ ×ÅÒÔÉËÁÌØÎÏ (ÏÔÎÏÓÉÔÅÌØÎÏ ÏÓÉ X)"
|
// "ÏÔÒÁÚÉÔØ ÉÚÏÂÒÁÖÅÎÉÅ ×ÅÒÔÉËÁÌØÎÏ (ÏÔÎÏÓÉÔÅÌØÎÏ ÏÓÉ X)"
|
||||||
_("flip image vertically (around X axe)"));
|
_("flip image vertically (around X axe)"));
|
||||||
@ -277,7 +284,7 @@ void usage(char *fmt, ...){
|
|||||||
void parse_args(int argc, char **argv){
|
void parse_args(int argc, char **argv){
|
||||||
FNAME();
|
FNAME();
|
||||||
int i;
|
int i;
|
||||||
char short_options[] = "A:b:cC:dDE:fF:gG:H:h:I:i:LlM:N:n:O:o:P:p:Rr:SsTt:v:Ww:x:X:Y:";
|
char short_options[] = "A:b:B:cC:dDE:fF:gG:H:h:I:i:LlM:N:n:O:o:P:p:Rr:SsTt:v:Ww:x:X:Y:";
|
||||||
struct option long_options[] = {
|
struct option long_options[] = {
|
||||||
/* { name, has_arg, flag, val }, ÇÄÅ:
|
/* { name, has_arg, flag, val }, ÇÄÅ:
|
||||||
* name - name of long parameter
|
* name - name of long parameter
|
||||||
@ -289,6 +296,7 @@ void parse_args(int argc, char **argv){
|
|||||||
*/
|
*/
|
||||||
{"author", 1, 0, 'A'},
|
{"author", 1, 0, 'A'},
|
||||||
{"defhdr", 1, 0, 'b'},
|
{"defhdr", 1, 0, 'b'},
|
||||||
|
{"observers", 1, 0, 'B'},
|
||||||
{"cooler-off", 0, 0, 'c'},
|
{"cooler-off", 0, 0, 'c'},
|
||||||
{"imscale", 1, 0, 'C'},
|
{"imscale", 1, 0, 'C'},
|
||||||
{"dark", 0, 0, 'd'},
|
{"dark", 0, 0, 'd'},
|
||||||
@ -307,8 +315,8 @@ void parse_args(int argc, char **argv){
|
|||||||
{"msg-id", 1, 0, 'M'},
|
{"msg-id", 1, 0, 'M'},
|
||||||
{"ncam", 1, 0, 'N'},
|
{"ncam", 1, 0, 'N'},
|
||||||
{"nframes", 1, 0, 'n'},
|
{"nframes", 1, 0, 'n'},
|
||||||
|
{"outfile", 1, 0, 'o'},
|
||||||
{"object", 1, 0, 'O'},
|
{"object", 1, 0, 'O'},
|
||||||
{"observers", 1, 0, 'o'},
|
|
||||||
{"prog-id", 1, 0, 'P'},
|
{"prog-id", 1, 0, 'P'},
|
||||||
{"pause-len", 1, 0, 'p'},
|
{"pause-len", 1, 0, 'p'},
|
||||||
{"reset", 0, 0, 'R'},
|
{"reset", 0, 0, 'R'},
|
||||||
@ -324,6 +332,7 @@ void parse_args(int argc, char **argv){
|
|||||||
{"xclip", 1, 0, 'X'},
|
{"xclip", 1, 0, 'X'},
|
||||||
{"yclip", 1, 0, 'Y'},
|
{"yclip", 1, 0, 'Y'},
|
||||||
// options, that have no short analogs:
|
// options, that have no short analogs:
|
||||||
|
{"fakeimg", 0, &fake, 1},
|
||||||
{"flipX", 0, &flipX, 1},
|
{"flipX", 0, &flipX, 1},
|
||||||
{"flipY", 0, &flipY, 1},
|
{"flipY", 0, &flipY, 1},
|
||||||
{"noclean", 0, &noclean, 1},
|
{"noclean", 0, &noclean, 1},
|
||||||
@ -354,6 +363,11 @@ void parse_args(int argc, char **argv){
|
|||||||
case 'b':
|
case 'b':
|
||||||
defhdr_filename = strdup(optarg);
|
defhdr_filename = strdup(optarg);
|
||||||
break;
|
break;
|
||||||
|
case 'B':
|
||||||
|
observers = strdup(optarg);
|
||||||
|
// "îÁÂÌÀÄÁÔÅÌÉ: %s"
|
||||||
|
info(_("Observers: %s"), observers);
|
||||||
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
only_turret = FALSE;
|
only_turret = FALSE;
|
||||||
set_T = TRUE;
|
set_T = TRUE;
|
||||||
@ -470,16 +484,16 @@ void parse_args(int argc, char **argv){
|
|||||||
// "óÅÒÉÑ ÉÚ %d ËÁÄÒÏ×"
|
// "óÅÒÉÑ ÉÚ %d ËÁÄÒÏ×"
|
||||||
info(_("Series of %d frames"), pics);
|
info(_("Series of %d frames"), pics);
|
||||||
break;
|
break;
|
||||||
|
case 'o':
|
||||||
|
outfile = strdup(optarg);
|
||||||
|
// "ðÒÅÆÉËÓ ×ÙÈÏÄÎÏÇÏ ÆÁÊÌÁ"
|
||||||
|
info(_("Output filename prefix: %s"), outfile);
|
||||||
|
break;
|
||||||
case 'O':
|
case 'O':
|
||||||
objname = strdup(optarg);
|
objname = strdup(optarg);
|
||||||
// "éÍÑ ÏÂßÅËÔÁ - %s"
|
// "éÍÑ ÏÂßÅËÔÁ - %s"
|
||||||
info(_("Object name - %s"), objname);
|
info(_("Object name - %s"), objname);
|
||||||
break;
|
break;
|
||||||
case 'o':
|
|
||||||
observers = strdup(optarg);
|
|
||||||
// "îÁÂÌÀÄÁÔÅÌÉ: %s"
|
|
||||||
info(_("Observers: %s"), observers);
|
|
||||||
break;
|
|
||||||
case 'P':
|
case 'P':
|
||||||
prog_id = strdup(optarg);
|
prog_id = strdup(optarg);
|
||||||
// "îÁÚ×ÁÎÉÅ ÐÒÏÇÒÁÍÍÙ: %s"
|
// "îÁÚ×ÁÎÉÅ ÐÒÏÇÒÁÍÍÙ: %s"
|
||||||
@ -578,23 +592,22 @@ void parse_args(int argc, char **argv){
|
|||||||
usage(NULL);
|
usage(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
argc -= optind;
|
if(fake){
|
||||||
argv += optind;
|
only_turret = FALSE;
|
||||||
if(argc == 0){
|
|
||||||
save_image = FALSE;
|
save_image = FALSE;
|
||||||
}
|
}
|
||||||
else if(!strchr(argv[0], '=') && !strchr(argv[0], ' ')){ // argv[0] is a filename
|
argc -= optind;
|
||||||
outfile = argv[0];
|
argv += optind;
|
||||||
argc--;
|
if(outfile == NULL){
|
||||||
argv++;
|
save_image = FALSE;
|
||||||
}
|
}
|
||||||
get_defhdrs(defhdr_filename);
|
get_defhdrs(defhdr_filename);
|
||||||
if(argc > 0){ // additional headers
|
if(argc > 0){ // additional headers
|
||||||
// "äÏÐÏÌÎÉÔÅÌØÎÙÅ ÚÁÇÏÌÏ×ËÉ:\n"
|
// "äÏÐÏÌÎÉÔÅÌØÎÙÅ ÚÁÇÏÌÏ×ËÉ: "
|
||||||
info(_("Additional headers"));
|
info(_("Additional headers: "));
|
||||||
for (i = 0; i < argc; i++)
|
for (i = 0; i < argc; i++)
|
||||||
info("%s ", argv[i]);
|
info("%s ", argv[i]);
|
||||||
}
|
|
||||||
add_morehdrs(argc, argv);
|
add_morehdrs(argc, argv);
|
||||||
|
}
|
||||||
if(Shtr != -1) only_turret = FALSE;
|
if(Shtr != -1) only_turret = FALSE;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user