syncking code and documentation
This commit is contained in:
parent
47de778e60
commit
1364698e63
@ -211,9 +211,12 @@ lesquels sont décrits en page \pageref{outils}.
|
||||
Vous devez, en dehors des outils classiques (bash, gcc, make\dots),
|
||||
avoir quelques bibliothèques installées\footnote{Les \texttt{-dev}
|
||||
pour Debian et dérivées}~:
|
||||
\textsf{libv4l2, libpnglite, libtiff,
|
||||
\textsf{
|
||||
libv4l2, libpnglite, libtiff,
|
||||
libnetpbm\footnote{package libnetpbm10-dev},
|
||||
libz\footnote{package zlib1g-dev}},
|
||||
libz\footnote{package zlib1g-dev}, libcurses,
|
||||
libcfitsio-dev
|
||||
} % en of textsf
|
||||
éventuellement avec le \textsf{-dev} correspondant,
|
||||
et probablement d'autres choses.
|
||||
|
||||
@ -632,6 +635,8 @@ la NASA.
|
||||
|
||||
\begin{lstlisting}
|
||||
int fimg_save_R_as_fits(FloatImg *src, char *outname, int flags);
|
||||
int fimg_save_G_as_fits(FloatImg *src, char *outname, int flags);
|
||||
int fimg_save_B_as_fits(FloatImg *src, char *outname, int flags);
|
||||
\end{lstlisting}
|
||||
|
||||
Bizarrement, l'image est stockée \textsl{upside-down} et je ne
|
||||
|
@ -3,7 +3,7 @@
|
||||
* ugly code from tTh
|
||||
*/
|
||||
|
||||
#define FIMG_VERSION 104
|
||||
#define FIMG_VERSION 105
|
||||
|
||||
/*
|
||||
* in memory descriptor
|
||||
|
@ -16,12 +16,13 @@
|
||||
extern int verbosity;
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
int fimg_save_R_as_fits(FloatImg *src, char *outname, int flags)
|
||||
int fimg_save_plane_as_fits(FloatImg *src, char *outname,
|
||||
char plane, int flags)
|
||||
{
|
||||
fitsfile *fptr; /* pointer to the FITS file */
|
||||
int status, sz;
|
||||
int bitpix = FLOAT_IMG;
|
||||
|
||||
float *pplane;
|
||||
long naxis = 2;
|
||||
long naxes[2];
|
||||
|
||||
@ -31,6 +32,18 @@ fprintf(stderr, ">>> %s ( %p '%s' %d )\n", __func__, src, outname, flags);
|
||||
|
||||
status = 0;
|
||||
|
||||
switch (plane) {
|
||||
case 'r': case 'R':
|
||||
pplane = src->R; break;
|
||||
case 'g': case 'G':
|
||||
pplane = src->G; break;
|
||||
case 'b': case 'B':
|
||||
pplane = src->B; break;
|
||||
default:
|
||||
return -66;
|
||||
}
|
||||
|
||||
|
||||
remove(outname); /* Delete old file if it already exists */
|
||||
if (fits_create_file(&fptr, outname, &status)) {
|
||||
fits_report_error(stderr, status);
|
||||
@ -47,7 +60,7 @@ if ( fits_create_img(fptr, bitpix, naxis, naxes, &status) ) {
|
||||
}
|
||||
|
||||
sz = naxes[0]*naxes[1];
|
||||
if ( fits_write_img(fptr, TFLOAT, 1, sz, src->R, &status) ) {
|
||||
if ( fits_write_img(fptr, TFLOAT, 1, sz, pplane, &status) ) {
|
||||
fits_report_error(stderr, status);
|
||||
return -10;
|
||||
}
|
||||
@ -60,6 +73,26 @@ if ( fits_close_file(fptr, &status) ) {
|
||||
return 0;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
int fimg_save_R_as_fits(FloatImg *src, char *outname, int flags)
|
||||
{
|
||||
int retv;
|
||||
retv = fimg_save_plane_as_fits(src, outname, 'r', flags);
|
||||
return retv;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
int fimg_save_G_as_fits(FloatImg *src, char *outname, int flags)
|
||||
{
|
||||
int retv;
|
||||
retv = fimg_save_plane_as_fits(src, outname, 'g', flags);
|
||||
return retv;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
int fimg_save_B_as_fits(FloatImg *src, char *outname, int flags)
|
||||
{
|
||||
int retv;
|
||||
retv = fimg_save_plane_as_fits(src, outname, 'b', flags);
|
||||
return retv;
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
***** MAGIC CODE FROM OUTERSPACE ?
|
||||
|
Loading…
Reference in New Issue
Block a user