-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgp_imagergbl.h
More file actions
227 lines (155 loc) · 5.77 KB
/
gp_imagergbl.h
File metadata and controls
227 lines (155 loc) · 5.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
/*
* Exposit Copyright (C) 2009,2010 Cristelle Barillon & Jean-Daniel Pauget
* efficiently stacking astro pics
*
* exposit@disjunkt.com - http://exposit.disjunkt.com/
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* you can also try the web at http://www.gnu.org/
*
*/
#ifndef GPIMAGERGBLINCLUDED
#define GPIMAGERGBLINCLUDED
#include <SDL.h>
#include <map>
#include <fitsio.h>
#include "starsmap.h"
namespace exposit {
using namespace std;
class PixelCoord {
public:
int x, y;
PixelCoord (int x, int y) : x(x), y(y) {}
};
class ImageRGBL {
void freeall (void);
bool allocateall (void);
bool allocate_mask (void);
inline int dabs (int a, int b) {
if (a > b)
return a-b;
else
return b-a;
}
public:
int w, h;
int maxlev; // 256 for png/jpg, 65536 for ppm (imported raw images)
int **r, **g, **b, **l, **msk;
bool isallocated;
bool histog_valid;
int histmask;
int histshift;
int maxr, minr,
maxg, ming,
maxb, minb,
maxl, minl,
curmsk;
map<int,int> hr, hg, hb, hl; // histogramms
int Max; // if histog_valid, the highest value in h*
static int debug;
static bool chrono;
~ImageRGBL ();
ImageRGBL (int w, int h);
ImageRGBL (SDL_Surface & surface, int lcrop = 0, int rcrop = 0, int tcrop = 0, int bcrop = 0);
ImageRGBL (fitsfile * fptr, int lcrop = 0, int rcrop = 0, int tcrop = 0, int bcrop = 0);
ImageRGBL (const char * fname); // loading some xpo file
bool save_xpo (const char * fnane);
bool turnmaskon (int defvalue = 1);
void setluminance (void);
void setmax (void);
void un_bayer (void); // uses luminance in order to build a rgb image
void un_BandsArtifacts (void);
void upsidedown (void);
ImageRGBL *rotate (double ang);
ImageRGBL *doublescale (void);
int shiftnonegative (void);
ImageRGBL *gauss (double ray, int topceil);
ImageRGBL *gaussfaster (double ray, int topceil);
ImageRGBL *silly (ImageRGBL &gauss, double strength, double resilient);
void render_onehist (int base, int noise, int gain, map <int,int> &hs, int Max, int vmax,
SDL_Surface &surface, int xoff, int yoff, int width, int height,
Uint32 cline, Uint32 color);
void renderhist (SDL_Surface &surface, int xoff, int yoff, int width, int height, int base, int gain);
void renderzoom (SDL_Surface &surface, int xoff, int yoff, int width, int height, int base, int nblevs, double gamma, int xs, int ys, int ws, int hs);
ImageRGBL *subsample (int sub);
void rendermax (SDL_Surface &surface, int xoff, int yoff, int width, int height);
void renderseuil (SDL_Surface &surface, int xoff, int yoff, int width, int height, int seuil);
void rendernodiff (SDL_Surface &surface, int xoff, int yoff, int width, int height);
void render (SDL_Surface &surface, int xoff, int yoff, int width, int height, int base, int nblevs, double gamma);
bool save_png (const char * fname);
bool savecorrected (const char * fname, int base, int nblevs, double gamma);
void fasthistogramme (int step, map<int,int> &hr, map<int,int> &hg, map<int,int> &hb, map<int,int> &hl);
void fasthistogramme (int step);
void histogramme (void);
void substract (ImageRGBL & image);
void remove_refnoise (ImageRGBL & refnoise, int n);
void falloff_correct (ImageRGBL & falloffref);
void substractR (int n);
void substractG (int n);
void substractB (int n);
void maxminize (void);
int averageabsR (void);
long long diff (ImageRGBL &ref, int xr, int yr, int width, int height, int dx, int dy);
long long diff (ImageRGBL &ref, int xr, int yr, int width, int height, int dx, int dy, int cut);
long long optimaldiff (ImageRGBL &ref, int dx, int dy);
long long find_match (ImageRGBL &ref, int x, int y, int width, int height, int &dx, int &dy, int maxdd);
long long optimal_find_match (ImageRGBL &ref, int &dx, int &dy, int maxdd);
void maximize (void);
void minimize (void);
void zero (void);
void trunk (int n);
void substract (int n);
void add (ImageRGBL &image, int dx, int dy);
void brighters (size_t nb, multimap <int, PixelCoord> &mm);
static multimap <int, PixelCoord> scpec_mmap;
void initspecularite (int m);
int specularite (int x, int y);
void study_specularity (StarsMap const & sm);
int conic_sum (int x, int y);
#define M81ITELESCOPET3
#ifdef ORIGINALSETTINGS
# define SUBSBASE 4
# define NBMAXSPOTS 2000
# define BRIGHTLISTDIVISOR 10
#else
# ifdef VIRGOSETTINGS
// JDJDJDJD pour m31 surexposee (was used for orion m42+flameneb first startrack)
// virgo first attempt
# define SUBSBASE 4
# define NBMAXSPOTS 4000
# define BRIGHTLISTDIVISOR 20
# else
# ifdef M81ITELESCOPET3
# define SUBSBASE 4
# define NBMAXSPOTS 4000
# define BRIGHTLISTDIVISOR 20
# else
# define SUBSBASE 8
# define NBMAXSPOTS 4000
# define BRIGHTLISTDIVISOR 20
# endif
# endif
#endif
// JDJDJDJD pour panstarrs
//# define SUBSBASE 4
//# define NBMAXSPOTS 60
//# define BRIGHTLISTDIVISOR 20
StarsMap * graphe_stars (void);
static void setdebug (int d);
static void setchrono (bool c);
};
} // namepsace exposit
#endif // GPIMAGERGBLINCLUDED