Openholo
v5.0
Open Source Digital Holographic Library
|
Abstract class. More...
#include <Openholo.h>
Public Member Functions | |
Openholo (void) | |
Constructor. More... | |
virtual bool | saveAsImg (const char *fname, uint8_t bitsperpixel, uchar *src, int width, int height) |
Function for creating image files. More... | |
virtual uchar * | loadAsImg (const char *fname) |
Function for loading image files. More... | |
virtual bool | saveAsOhc (const char *fname) |
Function to write OHC file More... | |
virtual bool | loadAsOhc (const char *fname) |
Function to read OHC file. More... | |
Complex< Real > ** | getComplexField (void) |
Function for getting the complex field. More... | |
OphConfig & | getContext (void) |
Function for getting the current context. More... | |
ImageConfig & | getImageConfig () |
Function for getting the image config. More... | |
void | setPixelNumber (ivec2 n) |
Function for setting the output resolution. More... | |
void | setPixelNumber (int width, int height) |
void | setPixelPitch (vec2 p) |
Function for setting the output pixel pitch. More... | |
void | setPixelPitch (Real pitchX, Real pitchY) |
void | setWaveLength (Real w, const uint idx=0) |
Function for setting the wave length. More... | |
void | setWaveNum (int num) |
Function for setting the wave number. More... | |
void | setOffset (ivec2 offset) |
Function for setting the offset. More... | |
void | setImageMerge (bool merge) |
Function for setting the image merge(true or false) More... | |
void | setImageRotate (bool rotate) |
Function for setting the image rotate(true or false) More... | |
void | setImageFlip (int flip) |
Function for setting the image flip. More... | |
void | setMaxThreadNum (int num) |
Function for setting the max thread num. More... | |
int | getMaxThreadNum () |
Function for getting the max thread num. More... | |
bool | mergeColor (int idx, int width, int height, uchar *src, uchar *dst) |
Function for generate RGB image from each grayscale image. More... | |
bool | separateColor (int idx, int width, int height, uchar *src, uchar *dst) |
Function for generate each grayscale image from RGB image. More... | |
Public Member Functions inherited from Base | |
Base (void) | |
Constructor. More... | |
unsigned long | addRef (void) |
If referenced this(Base's child, not abstract class) instance, must call this method. More... | |
unsigned long | release (void) |
Call release() when reference is finished. More... | |
Protected Member Functions | |
virtual | ~Openholo (void)=0 |
Destructor. More... | |
bool | checkExtension (const char *fname, const char *ext) |
Functions for extension checking. More... | |
bool | loadAsImgUpSideDown (const char *fname, uchar *dst) |
Function for loading image files | Output image data upside down. More... | |
bool | getImgSize (int &w, int &h, int &bytesperpixel, const char *fname) |
Function for getting the image size. More... | |
void | imgScaleBilinear (uchar *src, uchar *dst, int w, int h, int neww, int newh, int channels=1) |
Function for change image size. More... | |
void | convertToFormatGray8 (uchar *src, uchar *dst, int w, int h, int bytesperpixel) |
Function for convert image format to gray8. More... | |
void | fft1 (int n, Complex< Real > *in, int sign=OPH_FORWARD, uint flag=OPH_ESTIMATE) |
Functions for performing fftw 1-dimension operations inside Openholo. More... | |
void | fft2 (ivec2 n, Complex< Real > *in, int sign=OPH_FORWARD, uint flag=OPH_ESTIMATE) |
Functions for performing fftw 2-dimension operations inside Openholo. More... | |
void | fft3 (ivec3 n, Complex< Real > *in, int sign=OPH_FORWARD, uint flag=OPH_ESTIMATE) |
Functions for performing fftw 3-dimension operations inside Openholo. More... | |
void | fftExecute (Complex< Real > *out, bool bReverse=false) |
Execution functions to be called after fft1, fft2, and fft3. More... | |
void | fftFree (void) |
Resource release method. More... | |
void | fftInit2D (ivec2 size, int sign, unsigned int flag) |
initialize method for 2D FFT More... | |
void | fft2 (Complex< Real > *src, Complex< Real > *dst, int nx, int ny, int type, bool bNormalized=false, bool bShift=true) |
Convert data from the spatial domain to the frequency domain using 2D FFT on CPU. More... | |
void | fftShift (int nx, int ny, Complex< Real > *input, Complex< Real > *output) |
Swap the top-left quadrant of data with the bottom-right , and the top-right quadrant with the bottom-left. More... | |
virtual void | ophFree (void) |
Pure virtual function for override in child classes. More... | |
void | setPixelNumberOHC (const ivec2 pixel_number) |
getter/setter for OHC file read and write More... | |
void | setPixelPitchOHC (const vec2 pixel_pitch) |
void | setWavelengthOHC (const Real wavelength, const LenUnit wavelength_unit) |
void | setWaveLengthNumOHC (const uint wavelength_num) |
void | setColorTypeOHC (const ColorType color_type) |
void | setColorArrangeOHC (const ColorArran color_arrange) |
void | setWaveLengthUnitOHC (const LenUnit length_unit) |
void | setFieldEncodingOHC (const FldStore field_store, const FldCodeType field_code_type) |
void | setPhaseEncodingOHC (const BPhaseCode phase_code, const vec2 phase_code_range) |
void | addWaveLengthNComplexFieldDataOHC (const Real wavelength, const OphComplexField &complex_field) |
Function to add ComplexField when adding wavelength data. More... | |
void | addWaveLengthOHC (const Real wavelength) |
void | addComplexFieldDataOHC (const OphComplexField &complex_field) |
void | getPixelNumberOHC (ivec2 &pixel_number) |
void | getPixelPitchOHC (vec2 &pixel_pitch) |
void | getWavelengthOHC (vector< Real > &wavelength) |
void | getWaveLengthNumOHC (uint &wavelength_num) |
void | getColorTypeOHC (ColorType &color_type) |
void | getColorArrangeOHC (ColorArran &color_arrange) |
void | getWaveLengthUnitOHC (LenUnit &length_unit) |
void | getComplexFieldDataOHC (Complex< Real > **cmplx, uint wavelen_idx) |
void | getComplexFieldDataOHC (OphComplexField &cmplx, uint wavelen_idx) |
Protected Member Functions inherited from Base | |
virtual | ~Base (void) |
Destructor. More... | |
Protected Attributes | |
OphConfig | context_ |
ResolutionConfig | resCfg |
ImageConfig | imgCfg |
Complex< Real > ** | complex_H |
ImgEncoderOhc * | OHC_encoder |
OHC file format Variables for read and write. More... | |
ImgDecoderOhc * | OHC_decoder |
Protected Attributes inherited from Base | |
unsigned long | refCnt |
Abstract class.
Top class of Openholo library. Common functions required by subclasses are implemented.
Definition at line 145 of file Openholo.h.
|
explicit |
Constructor.
Definition at line 53 of file Openholo.cpp.
|
protectedpure virtual |
|
inlineprotected |
Definition at line 537 of file Openholo.h.
|
inlineprotected |
Function to add ComplexField when adding wavelength data.
Definition at line 531 of file Openholo.h.
|
inlineprotected |
Definition at line 534 of file Openholo.h.
|
protected |
Functions for extension checking.
[in] | fname | File name |
[in] | ext | File extension |
Definition at line 86 of file Openholo.cpp.
|
protected |
Function for convert image format to gray8.
[in] | src | Source image data. |
[out] | dst | Destination image data. |
[in] | w | Image size, width. |
[in] | h | Image size, Height. |
[in] | bytesperpixel | Bytes per pixel. |
Definition at line 511 of file Openholo.cpp.
|
protected |
Functions for performing fftw 1-dimension operations inside Openholo.
[in] | n | Number of data. |
[in] | in | Source of data. |
[in] | sign | Sign of FFTW(FORWARD or BACKWARD) |
[in] | flag | Flag of FFTW(MEASURE, DESTROY_INPUT, UNALIGNED, CONSERVE_MEMORY, EXHAUSTIVE, PRESERVE_INPUT, PATIENT, ESTIMATE, WISDOM_ONLY) |
Definition at line 527 of file Openholo.cpp.
|
protected |
Functions for performing fftw 2-dimension operations inside Openholo.
[in] | n | Number of data(int x, int y) |
[in] | in | Source of data. |
[in] | sign | Sign of FFTW(FORWARD or BACKWARD) |
[in] | flag | Flag of FFTW(MEASURE, DESTROY_INPUT, UNALIGNED, CONSERVE_MEMORY, EXHAUSTIVE, PRESERVE_INPUT, PATIENT, ESTIMATE, WISDOM_ONLY) |
Definition at line 559 of file Openholo.cpp.
|
protected |
Convert data from the spatial domain to the frequency domain using 2D FFT on CPU.
[in] | src | Input data variable. |
[out] | dst | Output data variable. |
[in] | nx | the number of column of the input data. |
[in] | ny | the number of row of the input data. |
[in] | type | If type == 1, forward FFT, if type == -1, backward FFT. |
[in] | bNormalized | If bNomarlized == true, normalize the result after FFT. |
[in] | bShift | If bShift == true, shifts the input and output values before and after the FFT. |
Definition at line 698 of file Openholo.cpp.
|
protected |
Functions for performing fftw 3-dimension operations inside Openholo.
[in] | n | Number of data(int x, int y, int z) |
[in] | in | Source of data. |
[in] | sign | Sign of FFTW(FORWARD or BACKWARD) |
[in] | flag | Flag of FFTW(MEASURE, DESTROY_INPUT, UNALIGNED, CONSERVE_MEMORY, EXHAUSTIVE, PRESERVE_INPUT, PATIENT, ESTIMATE, WISDOM_ONLY) |
Definition at line 587 of file Openholo.cpp.
Execution functions to be called after fft1, fft2, and fft3.
[out] | out | Dest of data. |
Definition at line 623 of file Openholo.cpp.
|
protected |
Resource release method.
Definition at line 677 of file Openholo.cpp.
|
protected |
initialize method for 2D FFT
[in] | size | Number of data (int x, int y) |
[in] | sign | Sign of FFTW(FORWARD or BACKWARD) |
[in] | flag | Flag of FFTW(MEASURE, DESTROY_INPUT, UNALIGNED, CONSERVE_MEMORY, EXHAUSTIVE, PRESERVE_INPUT, PATIENT, ESTIMATE, WISDOM_ONLY) |
Definition at line 660 of file Openholo.cpp.
|
protected |
Swap the top-left quadrant of data with the bottom-right , and the top-right quadrant with the bottom-left.
[in] | nx | the number of column of the input data. |
[in] | ny | the number of row of the input data. |
[in] | input | input data variable. |
[out] | output | output data variable. |
Definition at line 755 of file Openholo.cpp.
|
inlineprotected |
Definition at line 555 of file Openholo.h.
|
inlineprotected |
Definition at line 552 of file Openholo.h.
Function for getting the complex field.
Definition at line 220 of file Openholo.h.
|
inlineprotected |
Definition at line 561 of file Openholo.h.
|
inlineprotected |
Definition at line 564 of file Openholo.h.
|
inline |
Function for getting the current context.
Definition at line 229 of file Openholo.h.
|
inline |
Function for getting the image config.
Definition at line 236 of file Openholo.h.
|
protected |
Function for getting the image size.
[out] | w | Image size - width. |
[out] | h | Image size - Height. |
[out] | bytesperpixel | Bytes per pixel. |
[in] | fname | Input file name. |
Definition at line 402 of file Openholo.cpp.
int Openholo::getMaxThreadNum | ( | ) |
Function for getting the max thread num.
Definition at line 799 of file Openholo.cpp.
|
inlineprotected |
Definition at line 540 of file Openholo.h.
|
inlineprotected |
Definition at line 543 of file Openholo.h.
|
inlineprotected |
Definition at line 549 of file Openholo.h.
|
inlineprotected |
Definition at line 546 of file Openholo.h.
|
inlineprotected |
Definition at line 558 of file Openholo.h.
|
protected |
Function for change image size.
[in] | src | Source image data. |
[out] | dst | Destination image data. |
[in] | w | Original width. |
[in] | h | Original height. |
[in] | neww | Width to replace. |
[in] | newh | Height to replace. |
Definition at line 437 of file Openholo.cpp.
|
virtual |
Function for loading image files.
[in] | fname | Input file name |
Definition at line 321 of file Openholo.cpp.
|
protected |
Function for loading image files | Output image data upside down.
[in] | Input | file name. |
[out] | destination | to load. |
Definition at line 353 of file Openholo.cpp.
|
virtual |
Function to read OHC file.
[in] | fname | File name |
Reimplemented in ophSig, ophGen, ophCascadedPropagation, and ophWaveAberration.
Definition at line 280 of file Openholo.cpp.
Function for generate RGB image from each grayscale image.
[in] | idx | : 0 is red, 1 is green, 2 is blue. |
[in] | width | : Number of pixel - width |
[in] | height | : Number of pixel - height |
[in] | src | : Source of Image file's data - grayscale |
[out] | dst | : Destination of Image file's data - RGB |
Definition at line 103 of file Openholo.cpp.
|
protectedvirtual |
Pure virtual function for override in child classes.
Implements Base.
Reimplemented in ophGen, ophSig, ophCascadedPropagation, ophDepthMap, ophWaveAberration, ophLF, and ophRec.
Definition at line 811 of file Openholo.cpp.
|
virtual |
Function for creating image files.
[in] | fname | Output file name |
[in] | bitsperpixel | Bit per pixel |
[in] | src | Source of Image file's data |
[in] | width | Number of pixel - width |
[in] | height | Number of pixel - height |
Definition at line 135 of file Openholo.cpp.
|
virtual |
Function to write OHC file
[in] | fname | File name |
Reimplemented in ophSig, and ophCascadedPropagation.
Definition at line 252 of file Openholo.cpp.
Function for generate each grayscale image from RGB image.
[in] | idx | : 0 is red, 1 is green, 2 is blue. |
[in] | width | : Number of pixel - width |
[in] | height | : Number of pixel - height |
[in] | src | : Source of Image file's data - RGB |
[out] | dst | : Destination of Image file's data - grayscale |
Definition at line 119 of file Openholo.cpp.
|
inlineprotected |
Definition at line 517 of file Openholo.h.
|
inlineprotected |
Definition at line 514 of file Openholo.h.
|
inlineprotected |
Definition at line 523 of file Openholo.h.
|
inline |
Function for setting the image flip.
if flip == 0 not change. else if flip == 1 vertical change. else if flipp == 2 horizon tal change. else B both.
[in] | rotate | : the value for specifying whether output image flip. |
Definition at line 318 of file Openholo.h.
|
inline |
Function for setting the image merge(true or false)
if merge == true One RGB image else Each grayscale image
[in] | merge | : the value for specifying whether output image merge. |
Definition at line 292 of file Openholo.h.
|
inline |
Function for setting the image rotate(true or false)
if rotate == true 180 degree rotate. else not change.
[in] | rotate | : the value for specifying whether output image rotate. |
Definition at line 303 of file Openholo.h.
void Openholo::setMaxThreadNum | ( | int | num | ) |
Function for setting the max thread num.
[in] | num | : number of max thread. |
Definition at line 787 of file Openholo.cpp.
|
inline |
Function for setting the offset.
[in] | offset | spatial domain offset value. |
Definition at line 281 of file Openholo.h.
|
inlineprotected |
Definition at line 526 of file Openholo.h.
|
inline |
Function for setting the output resolution.
[in] | n | resolution vector value. |
Definition at line 242 of file Openholo.h.
|
inline |
Definition at line 246 of file Openholo.h.
|
inlineprotected |
getter/setter for OHC file read and write
Definition at line 502 of file Openholo.h.
|
inline |
Function for setting the output pixel pitch.
[in] | p | pitch vector value. |
Definition at line 255 of file Openholo.h.
Definition at line 259 of file Openholo.h.
|
inlineprotected |
Definition at line 505 of file Openholo.h.
Function for setting the wave length.
[in] | w | wave length. |
[in] | idx | index of channel. |
Definition at line 269 of file Openholo.h.
|
inlineprotected |
Definition at line 511 of file Openholo.h.
|
inlineprotected |
Definition at line 508 of file Openholo.h.
|
inlineprotected |
Definition at line 520 of file Openholo.h.
void Openholo::setWaveNum | ( | int | num | ) |
Function for setting the wave number.
[in] | num | Number of wave/ |
Definition at line 776 of file Openholo.cpp.
Definition at line 490 of file Openholo.h.
|
protected |
Definition at line 486 of file Openholo.h.
|
protected |
Definition at line 488 of file Openholo.h.
|
protected |
Definition at line 496 of file Openholo.h.
|
protected |
OHC file format Variables for read and write.
Definition at line 495 of file Openholo.h.
|
protected |
Definition at line 487 of file Openholo.h.