VR-Vantage 3.0 API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
bmpmain.h
Go to the documentation of this file.
1 /* © 1998 JRM Technologies, Inc.*/
2 
3 #ifndef _JRMLIBRARY_BMPMAIN_H
4 #define _JRMLIBRARY_BMPMAIN_H
5 
6 #include "JRMlibraryDLLstub.h"
7 
8 #ifdef __cplusplus
9 extern "C"
10 {
11 #endif
12 
13 
14 #define BIT8 8
15 #define BIT16 16
16 #define WRITE 1
17 #define READ 0
18 #define READ_NORMALIZED 2
19 
20 #define SINGLE_VALID_CHANNEL 1
21 #define LOG_DISPLAY 2
22 #define FIMAGE_MAX 65535.0
23  // #define PI 3.141592654
24 #define FMAX8BIT 255.0
25 #define FMAX16BIT 65535.0
26 #define COLORS8BIT 256
27 #define COLORS16BIT 65536
28 #define PIXELSPERMETER 2834
29 
30 #define BI_RGB 0L
31 #define BI_RLE8 1L
32 #define BI_RLE4 2L
33 #define BI_BITFIELDS 3L
34 
35 #define SIZEOFbitmapFILEHEADER 14
36 
37  typedef long LONG;
38  typedef unsigned long ULONG;
39  typedef ULONG *PULONG;
40  typedef unsigned short USHORT;
41  typedef USHORT *PUSHORT;
42  typedef unsigned char UCHAR;
43 
44  typedef unsigned long DWORD;
45 #ifndef LINUX
46  typedef int BOOL;
47 #endif
48  typedef unsigned char BYTE;
49  typedef unsigned short WORD;
50  typedef float FLOAT;
51  typedef FLOAT *PFLOAT;
52 
53 
54  typedef int INT;
55  typedef unsigned int UINT;
56  typedef unsigned int *PUINT;
57 
58  typedef struct {
59  DWORD biSize;
60  LONG biWidth;
61  LONG biHeight;
62  WORD biPlanes;
63  WORD biBitCount;
65  DWORD biSizeImage;
68  DWORD biClrUsed;
71 
72  typedef struct {
73  BYTE rgbBlue;
74  BYTE rgbGreen;
75  BYTE rgbRed;
77  } RGBquad;
78 
79  typedef struct {
82  } bitmapINFO;
83 
84  typedef struct {
85  WORD bfType;
86  DWORD bfSize;
89  DWORD bfOffBits;
91 
92 
93  JRMLIBRARY_API double CardSpline_Step1(double t, double p1, double p2, double p3, double p4);
94  JRMLIBRARY_API void sample_bicubic(double *in, long npts, double *out, long sample_pts);
95  JRMLIBRARY_API void sample_quadratic(double *in, long npts, double *out, long sample_pts);
96  JRMLIBRARY_API double *BiCubic2D(double *array, long *num_cols, long *num_rows, long out_cols, long out_rows);
97  JRMLIBRARY_API void linear_interpolate(double *xin, double *yin, long inpts, double *xout, double *yout, long outpts, double limita, double d);
98  JRMLIBRARY_API double *MirrorImage(double *fimage, long *num_cols, long *num_rows, long mirror_cols, long mirror_rows);
99  JRMLIBRARY_API double *CropImage(double *fimage, long *num_cols, long *num_rows, long crop_cols, long crop_rows, long start_col, long start_row);
100  JRMLIBRARY_API void MirrorFunction(double **x, double **y, long inpts, long outpts);
101  JRMLIBRARY_API void MirrorComplexFunctionUnindexed(COMPLEX **y, long inpts, long outpts);
102  JRMLIBRARY_API void MirrorFunctionUnindexed(double **y, long inpts, long outpts);
103  JRMLIBRARY_API long OutputImage(double *fimage, long num_cols, long num_rows, long out_bit_depth, char *output_file, double gain, double level, long proc_flag);
104  JRMLIBRARY_API long OutputBMPImage2(double *fimage, long num_cols, long num_rows, long out_bit_depth, char *output_file, double gain, double level, long proc_flag);
105  JRMLIBRARY_API unsigned char *ReadWriteBMP(char *file, double **fimage, long *num_cols, long *num_rows, unsigned short *bit_depth, double gain, double level, long proc_flag, long readwrite,int *err);
106  JRMLIBRARY_API unsigned char *ReadWriteBMP2(char *file, double **fimage, long *num_cols, long *num_rows, unsigned short *bit_depth, double gain, double level, long proc_flag, long readwrite, double *fmax_in, double *fmin_in);
107 
108  //JRMLIBRARY_API int ReadWriteBMP(char *file, double **fimage, long *num_cols, long *num_rows, unsigned short *bit_depth, double gain, double level, long proc_flag, long readwrite);
109  JRMLIBRARY_API int Free_BMPImage(double** fimage);
110  JRMLIBRARY_API int hsfilenameBMP(int i, char* io, char* fileaddress); // Adds to string "io" the characters corresponding to the integer i, then adds the ".bmp" suffix, and returns the result in fileaddress.
111  JRMLIBRARY_API double* Create_BMPImage(int num_pixels);
112 
113  // I added this stuff -- MWO / kg
114 
115 #define JRMImage double*
116 #define JRMCImage COMPLEX*
117 
118  JRMLIBRARY_API JRMImage CreateJRMImage(int num_pixels);
119  JRMLIBRARY_API JRMCImage CreateJRMCImage(int num_pixels);
120  JRMLIBRARY_API void FreeJRMImage (JRMImage imagein);
121  JRMLIBRARY_API void FreeJRMCImage (JRMCImage cimagein);
122 
123 
124  /************** Below written by JH, added to SS4.7 CF040302 ****************/
125  typedef struct
126  {
127  short magic;
128  char storage;
129  char bpc;
130  unsigned short dimension, xsize, ysize, zsize;
131  long pixmin, pixmax;
132  char imagename[80];
133  long colormap;
134  } RGBSGIHeader;
135 
136  JRMLIBRARY_API unsigned char freadchar(FILE *fileon) ;
137  JRMLIBRARY_API unsigned short freadshort(FILE *fileon);
138  JRMLIBRARY_API unsigned long freadlong(FILE *fileon);
139  JRMLIBRARY_API void fwritechar(unsigned char charin, FILE *fileon);
140  JRMLIBRARY_API void fwriteshort(unsigned short shortin, FILE *fileon);
141  JRMLIBRARY_API void fwritelong(unsigned long longin, FILE *fileon);
142  JRMLIBRARY_API int expandrow(double *optr, unsigned char *iptr);
143  JRMLIBRARY_API double *ReadSGIRGB(char *filename, RGBSGIHeader *headeron);
144  JRMLIBRARY_API void WriteSGIRGB(char *filename, double *pixeldata, RGBSGIHeader *headeron);
145 
146  /* For reading fpf files */
147  JRMLIBRARY_API int *ReadFPFFileInt(char *filename, int width, int height);
148  JRMLIBRARY_API double *ReadFPFFileDouble(char *filename, int width, int height);
149  JRMLIBRARY_API float *ReadFPFFileFloat(char *filename, int width, int height);
150  JRMLIBRARY_API void WriteFPFFileInt(char *filename, int *idata, int width, int height);
151  JRMLIBRARY_API void WriteFPFFileDouble(char *filename, double *ddata, int width, int height);
152  JRMLIBRARY_API void WriteFPFFileFloat(char *filename, float *fdata, int width, int height);
153  JRMLIBRARY_API void FreeFPFInt(int **data);
154  JRMLIBRARY_API void FreeFPFDouble(double **data);
155  JRMLIBRARY_API void FreeFPFFloat(float **data);
156 
157 
158  JRMLIBRARY_API lVEC_HV GetImageStatistics(int objectID, lVEC_HV *window_center, lVEC_HV window_extents, lVEC_HV image_extents, int objectIDDepth, int radianceDepth, double *objectidMap, double *radianceMap, double *avet, double *devt, double *numt, double *aveb, double *devb, double *numb);
159  JRMLIBRARY_API double averageimage(double *imagein, long num_cols, long num_rows, unsigned short bit_depth, double rmax, double rmin);
160 
161 
162  /************** Below written by CF SS4.9 CF060928 ********************/
163 
164 
165  JRMLIBRARY_API int ConvertCIED65toGivenSpectralDomain(long nlambda, double *lambda, double *CIED65);
166  JRMLIBRARY_API int MultiplyReflectivityByCIED65(long nlambda, double *lambda, double *reflectivity, double *CIEspectrum);
167  JRMLIBRARY_API double SpectralRadiance2Luminance(double lambda_um, double radiance_Wm2srum);
168  JRMLIBRARY_API double SpectralRadiance2LuminanceVstar(double lambda_um, double radiance_Wm2srum);
169  JRMLIBRARY_API int ConvertCIECMFtoGivenSpectralDomain(long nlambda, double *lambda, double *CIEX, double *CIEY, double *CIEZ);
170  JRMLIBRARY_API int CIEXYZforSpectrum(long nlambda, double *lambda, double *spectrum, double *X, double *Y, double *Z);
171  JRMLIBRARY_API double Clinear2Csrgb(double Clinear);
173  JRMLIBRARY_API int GetCIEsRGBfromReflectivitySpectrum(long nlambda, double *lambda, double *reflectivity, VECTOR *RGB);
175 
176 
177  /* ------------- N-Dim HSL Transform -------------------- */
180  JRMLIBRARY_API jrmbool SpectrumTransformToScaledSphericalGrayAxisSystem(double* input, int depth, double maxpixelvalue, double satweight, double lumweight); // main RGB to HSL call
181 
182 
183 #ifdef __cplusplus
184 }
185 #endif
186 
187 #endif // _JRMLIBRARY_BMPMAIN_H


Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)