Openholo  v4.0
Open Source Digital Holographic Library
Openholo Class Referenceabstract

Abstract class. More...

#include <Openholo.h>

Inheritance diagram for Openholo:
Collaboration diagram for Openholo:

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 ucharloadAsImg (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...
 
OphConfiggetContext (void)
 Function for getting the current context. More...
 
ImageConfiggetImageConfig ()
 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)
 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_
 
ImageConfig imgCfg
 
Complex< Real > ** complex_H
 
ImgEncoderOhcOHC_encoder
 OHC file format Variables for read and write. More...
 
ImgDecoderOhcOHC_decoder
 
- Protected Attributes inherited from Base
unsigned long refCnt
 

Detailed Description

Abstract class.

Top class of Openholo library. Common functions required by subclasses are implemented.

Author
Kim Ryeon-woo, Nam Min-woo

Definition at line 109 of file Openholo.h.

Constructor & Destructor Documentation

◆ Openholo()

Openholo::Openholo ( void  )
explicit

Constructor.

Definition at line 53 of file Openholo.cpp.

◆ ~Openholo()

Openholo::~Openholo ( void  )
protectedpure virtual

Destructor.

Pure virtual function for class abstraction

Definition at line 73 of file Openholo.cpp.

Member Function Documentation

◆ addComplexFieldDataOHC()

void Openholo::addComplexFieldDataOHC ( const OphComplexField complex_field)
inlineprotected

Definition at line 499 of file Openholo.h.

◆ addWaveLengthNComplexFieldDataOHC()

void Openholo::addWaveLengthNComplexFieldDataOHC ( const Real  wavelength,
const OphComplexField complex_field 
)
inlineprotected

Function to add ComplexField when adding wavelength data.

Definition at line 493 of file Openholo.h.

◆ addWaveLengthOHC()

void Openholo::addWaveLengthOHC ( const Real  wavelength)
inlineprotected

Definition at line 496 of file Openholo.h.

◆ checkExtension()

bool Openholo::checkExtension ( const char *  fname,
const char *  ext 
)
protected

Functions for extension checking.

Parameters
[in]fnameFile name
[in]extFile extension
Returns
Type: bool
If fname contains ext, the return value is true.
If fname not contains ext, the return value is false.

Definition at line 86 of file Openholo.cpp.

◆ convertToFormatGray8()

void Openholo::convertToFormatGray8 ( uchar src,
uchar dst,
int  w,
int  h,
int  bytesperpixel 
)
protected

Function for convert image format to gray8.

Parameters
[in]srcSource image data.
[out]dstDestination image data.
[in]wImage size, width.
[in]hImage size, Height.
[in]bytesperpixelBytes per pixel.

Definition at line 511 of file Openholo.cpp.

◆ fft1()

void Openholo::fft1 ( int  n,
Complex< Real > *  in,
int  sign = OPH_FORWARD,
uint  flag = OPH_ESTIMATE 
)
protected

Functions for performing fftw 1-dimension operations inside Openholo.

Parameters
[in]nNumber of data.
[in]inSource of data.
[in]signSign of FFTW(FORWARD or BACKWARD)
[in]flagFlag of FFTW(MEASURE, DESTROY_INPUT, UNALIGNED, CONSERVE_MEMORY, EXHAUSTIVE, PRESERVE_INPUT, PATIENT, ESTIMATE, WISDOM_ONLY)

Definition at line 527 of file Openholo.cpp.

◆ fft2() [1/2]

void Openholo::fft2 ( oph::ivec2  n,
Complex< Real > *  in,
int  sign = OPH_FORWARD,
uint  flag = OPH_ESTIMATE 
)
protected

Functions for performing fftw 2-dimension operations inside Openholo.

Parameters
[in]nNumber of data(int x, int y)
[in]inSource of data.
[in]signSign of FFTW(FORWARD or BACKWARD)
[in]flagFlag of FFTW(MEASURE, DESTROY_INPUT, UNALIGNED, CONSERVE_MEMORY, EXHAUSTIVE, PRESERVE_INPUT, PATIENT, ESTIMATE, WISDOM_ONLY)

Definition at line 559 of file Openholo.cpp.

◆ fft2() [2/2]

void Openholo::fft2 ( Complex< Real > *  src,
Complex< Real > *  dst,
int  nx,
int  ny,
int  type,
bool  bNormalized = false 
)
protected

Convert data from the spatial domain to the frequency domain using 2D FFT on CPU.

Parameters
[in]srcInput data variable.
[out]dstOutput data variable.
[in]nxthe number of column of the input data.
[in]nythe number of row of the input data.
[in]typeIf type == 1, forward FFT, if type == -1, backward FFT.
[in]bNormalizedIf bNomarlized == true, normalize the result after FFT.

Definition at line 698 of file Openholo.cpp.

◆ fft3()

void Openholo::fft3 ( oph::ivec3  n,
Complex< Real > *  in,
int  sign = OPH_FORWARD,
uint  flag = OPH_ESTIMATE 
)
protected

Functions for performing fftw 3-dimension operations inside Openholo.

Parameters
[in]nNumber of data(int x, int y, int z)
[in]inSource of data.
[in]signSign of FFTW(FORWARD or BACKWARD)
[in]flagFlag of FFTW(MEASURE, DESTROY_INPUT, UNALIGNED, CONSERVE_MEMORY, EXHAUSTIVE, PRESERVE_INPUT, PATIENT, ESTIMATE, WISDOM_ONLY)

Definition at line 587 of file Openholo.cpp.

◆ fftExecute()

void Openholo::fftExecute ( Complex< Real > *  out,
bool  bReverse = false 
)
protected

Execution functions to be called after fft1, fft2, and fft3.

Parameters
[out]outDest of data.

Definition at line 623 of file Openholo.cpp.

◆ fftFree()

void Openholo::fftFree ( void  )
protected

Resource release method.

Definition at line 677 of file Openholo.cpp.

◆ fftInit2D()

void Openholo::fftInit2D ( ivec2  size,
int  sign,
unsigned int  flag 
)
protected

initialize method for 2D FFT

Parameters
[in]sizeNumber of data (int x, int y)
[in]signSign of FFTW(FORWARD or BACKWARD)
[in]flagFlag of FFTW(MEASURE, DESTROY_INPUT, UNALIGNED, CONSERVE_MEMORY, EXHAUSTIVE, PRESERVE_INPUT, PATIENT, ESTIMATE, WISDOM_ONLY)

Definition at line 660 of file Openholo.cpp.

◆ fftShift()

void Openholo::fftShift ( int  nx,
int  ny,
Complex< Real > *  input,
Complex< Real > *  output 
)
protected

Swap the top-left quadrant of data with the bottom-right , and the top-right quadrant with the bottom-left.

Parameters
[in]nxthe number of column of the input data.
[in]nythe number of row of the input data.
[in]inputinput data variable.
[out]outputoutput data variable.

Definition at line 749 of file Openholo.cpp.

◆ getColorArrangeOHC()

void Openholo::getColorArrangeOHC ( ColorArran color_arrange)
inlineprotected

Definition at line 517 of file Openholo.h.

◆ getColorTypeOHC()

void Openholo::getColorTypeOHC ( ColorType color_type)
inlineprotected

Definition at line 514 of file Openholo.h.

◆ getComplexField()

Complex<Real>** Openholo::getComplexField ( void  )
inline

Function for getting the complex field.

Returns
Type: Complex<Real>**
If the succeeds to get complex field, the return value is complex field data's pointer.
If the fails to get complex field, the return value is nullptr.

Definition at line 184 of file Openholo.h.

◆ getComplexFieldDataOHC() [1/2]

void Openholo::getComplexFieldDataOHC ( Complex< Real > **  cmplx,
uint  wavelen_idx 
)
inlineprotected

Definition at line 523 of file Openholo.h.

◆ getComplexFieldDataOHC() [2/2]

void Openholo::getComplexFieldDataOHC ( OphComplexField cmplx,
uint  wavelen_idx 
)
inlineprotected

Definition at line 526 of file Openholo.h.

◆ getContext()

OphConfig& Openholo::getContext ( void  )
inline

Function for getting the current context.

Returns
Type: OphConfig&
If the succeeds to get context, the return value is cotext pointer.
If the fails to get context, the return value is nullptr.

Definition at line 193 of file Openholo.h.

◆ getImageConfig()

ImageConfig& Openholo::getImageConfig ( )
inline

Function for getting the image config.

Returns
Type: ImageConfig
The return value is Image config pointer.

Definition at line 200 of file Openholo.h.

◆ getImgSize()

bool Openholo::getImgSize ( int &  w,
int &  h,
int &  bytesperpixel,
const char *  fname 
)
protected

Function for getting the image size.

Parameters
[out]wImage size - width.
[out]hImage size - Height.
[out]bytesperpixelBytes per pixel.
[in]fnameInput file name.
Returns
Type: bool
If the function succeeds, the return value is true.
If the function fails, the return value is false.

Definition at line 402 of file Openholo.cpp.

◆ getMaxThreadNum()

int Openholo::getMaxThreadNum ( )

Function for getting the max thread num.

Returns
Type: int
If the currently max thread.

Definition at line 793 of file Openholo.cpp.

◆ getPixelNumberOHC()

void Openholo::getPixelNumberOHC ( ivec2 pixel_number)
inlineprotected

Definition at line 502 of file Openholo.h.

◆ getPixelPitchOHC()

void Openholo::getPixelPitchOHC ( vec2 pixel_pitch)
inlineprotected

Definition at line 505 of file Openholo.h.

◆ getWaveLengthNumOHC()

void Openholo::getWaveLengthNumOHC ( uint wavelength_num)
inlineprotected

Definition at line 511 of file Openholo.h.

◆ getWavelengthOHC()

void Openholo::getWavelengthOHC ( vector< Real > &  wavelength)
inlineprotected

Definition at line 508 of file Openholo.h.

◆ getWaveLengthUnitOHC()

void Openholo::getWaveLengthUnitOHC ( LenUnit length_unit)
inlineprotected

Definition at line 520 of file Openholo.h.

◆ imgScaleBilinear()

void Openholo::imgScaleBilinear ( uchar src,
uchar dst,
int  w,
int  h,
int  neww,
int  newh,
int  channels = 1 
)
protected

Function for change image size.

Parameters
[in]srcSource image data.
[out]dstDestination image data.
[in]wOriginal width.
[in]hOriginal height.
[in]newwWidth to replace.
[in]newhHeight to replace.

Definition at line 437 of file Openholo.cpp.

◆ loadAsImg()

uchar * Openholo::loadAsImg ( const char *  fname)
virtual

Function for loading image files.

Parameters
[in]fnameInput file name
Returns
Type: uchar*
If the succeeds to load image file, the return value is image data' pointer.
If the fails to load image file, the return value is nullptr.

Definition at line 321 of file Openholo.cpp.

◆ loadAsImgUpSideDown()

bool Openholo::loadAsImgUpSideDown ( const char *  fname,
uchar dst 
)
protected

Function for loading image files | Output image data upside down.

Parameters
[in]Inputfile name.
[out]destinationto load.
Returns
Type: bool
If the function succeeds, the return value is true.
If the function fails, the return value is false.

Definition at line 353 of file Openholo.cpp.

◆ loadAsOhc()

bool Openholo::loadAsOhc ( const char *  fname)
virtual

Function to read OHC file.

Parameters
[in]fnameFile name
Returns
Type: bool
If the succeeds to load OHC file, the return value is true.
If the fails to load OHC file, the return value is false.

Reimplemented in ophSig, ophGen, ophCascadedPropagation, and ophWaveAberration.

Definition at line 280 of file Openholo.cpp.

◆ mergeColor()

bool Openholo::mergeColor ( int  idx,
int  width,
int  height,
uchar src,
uchar dst 
)

Function for generate RGB image from each grayscale image.

Parameters
[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
Returns
Type: bool
If the succeeds to merge image, the return value is true.
If the fails to merge image, the return value is false.

Definition at line 103 of file Openholo.cpp.

◆ ophFree()

void Openholo::ophFree ( void  )
protectedvirtual

Pure virtual function for override in child classes.

Implements Base.

Reimplemented in ophGen, ophSig, ophCascadedPropagation, ophDepthMap, ophWaveAberration, ophLF, and ophRec.

Definition at line 805 of file Openholo.cpp.

◆ saveAsImg()

bool Openholo::saveAsImg ( const char *  fname,
uint8_t  bitsperpixel,
uchar src,
int  width,
int  height 
)
virtual

Function for creating image files.

Parameters
[in]fnameOutput file name
[in]bitsperpixelBit per pixel
[in]srcSource of Image file's data
[in]widthNumber of pixel - width
[in]heightNumber of pixel - height
Returns
Type: bool
If the succeeds to save image file, the return value is true.
If the fails to save image file, the return value is false.

Definition at line 135 of file Openholo.cpp.

◆ saveAsOhc()

bool Openholo::saveAsOhc ( const char *  fname)
virtual

Function to write OHC file

Parameters
[in]fnameFile name
Returns
Type: bool
If the succeeds to save OHC file, the return value is true.
If the fails to save OHC file, the return value is false.

Reimplemented in ophSig, and ophCascadedPropagation.

Definition at line 252 of file Openholo.cpp.

◆ separateColor()

bool Openholo::separateColor ( int  idx,
int  width,
int  height,
uchar src,
uchar dst 
)

Function for generate each grayscale image from RGB image.

Parameters
[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
Returns
Type: bool
If the succeeds to separate image, the return value is true.
If the fails to separate image, the return value is false.

Definition at line 119 of file Openholo.cpp.

◆ setColorArrangeOHC()

void Openholo::setColorArrangeOHC ( const ColorArran  color_arrange)
inlineprotected

Definition at line 479 of file Openholo.h.

◆ setColorTypeOHC()

void Openholo::setColorTypeOHC ( const ColorType  color_type)
inlineprotected

Definition at line 476 of file Openholo.h.

◆ setFieldEncodingOHC()

void Openholo::setFieldEncodingOHC ( const FldStore  field_store,
const FldCodeType  field_code_type 
)
inlineprotected

Definition at line 485 of file Openholo.h.

◆ setImageFlip()

void Openholo::setImageFlip ( int  flip)
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.
Parameters
[in]rotate: the value for specifying whether output image flip.

Definition at line 282 of file Openholo.h.

◆ setImageMerge()

void Openholo::setImageMerge ( bool  merge)
inline

Function for setting the image merge(true or false)

if merge == true
One RGB image
else
Each grayscale image 
Parameters
[in]merge: the value for specifying whether output image merge.

Definition at line 256 of file Openholo.h.

◆ setImageRotate()

void Openholo::setImageRotate ( bool  rotate)
inline

Function for setting the image rotate(true or false)

if rotate == true
180 degree rotate.
else
not change. 
Parameters
[in]rotate: the value for specifying whether output image rotate.

Definition at line 267 of file Openholo.h.

◆ setMaxThreadNum()

void Openholo::setMaxThreadNum ( int  num)

Function for setting the max thread num.

Parameters
[in]num: number of max thread.

Definition at line 781 of file Openholo.cpp.

◆ setOffset()

void Openholo::setOffset ( ivec2  offset)
inline

Function for setting the offset.

Parameters
[in]offsetspatial domain offset value.

Definition at line 245 of file Openholo.h.

◆ setPhaseEncodingOHC()

void Openholo::setPhaseEncodingOHC ( const BPhaseCode  phase_code,
const vec2  phase_code_range 
)
inlineprotected

Definition at line 488 of file Openholo.h.

◆ setPixelNumber() [1/2]

void Openholo::setPixelNumber ( ivec2  n)
inline

Function for setting the output resolution.

Parameters
[in]nresolution vector value.

Definition at line 206 of file Openholo.h.

◆ setPixelNumber() [2/2]

void Openholo::setPixelNumber ( int  width,
int  height 
)
inline

Definition at line 210 of file Openholo.h.

◆ setPixelNumberOHC()

void Openholo::setPixelNumberOHC ( const ivec2  pixel_number)
inlineprotected

getter/setter for OHC file read and write

Definition at line 464 of file Openholo.h.

◆ setPixelPitch() [1/2]

void Openholo::setPixelPitch ( vec2  p)
inline

Function for setting the output pixel pitch.

Parameters
[in]ppitch vector value.

Definition at line 219 of file Openholo.h.

◆ setPixelPitch() [2/2]

void Openholo::setPixelPitch ( Real  pitchX,
Real  pitchY 
)
inline

Definition at line 223 of file Openholo.h.

◆ setPixelPitchOHC()

void Openholo::setPixelPitchOHC ( const vec2  pixel_pitch)
inlineprotected

Definition at line 467 of file Openholo.h.

◆ setWaveLength()

void Openholo::setWaveLength ( Real  w,
const uint  idx = 0 
)
inline

Function for setting the wave length.

Parameters
[in]wwave length.
[in]idxindex of channel.

Definition at line 233 of file Openholo.h.

◆ setWaveLengthNumOHC()

void Openholo::setWaveLengthNumOHC ( const uint  wavelength_num)
inlineprotected

Definition at line 473 of file Openholo.h.

◆ setWavelengthOHC()

void Openholo::setWavelengthOHC ( const Real  wavelength,
const LenUnit  wavelength_unit 
)
inlineprotected

Definition at line 470 of file Openholo.h.

◆ setWaveLengthUnitOHC()

void Openholo::setWaveLengthUnitOHC ( const LenUnit  length_unit)
inlineprotected

Definition at line 482 of file Openholo.h.

◆ setWaveNum()

void Openholo::setWaveNum ( int  num)

Function for setting the wave number.

Parameters
[in]numNumber of wave/

Definition at line 770 of file Openholo.cpp.

Member Data Documentation

◆ complex_H

Complex<Real>** Openholo::complex_H
protected

Definition at line 452 of file Openholo.h.

◆ context_

OphConfig Openholo::context_
protected

Definition at line 449 of file Openholo.h.

◆ imgCfg

ImageConfig Openholo::imgCfg
protected

Definition at line 450 of file Openholo.h.

◆ OHC_decoder

ImgDecoderOhc* Openholo::OHC_decoder
protected

Definition at line 458 of file Openholo.h.

◆ OHC_encoder

ImgEncoderOhc* Openholo::OHC_encoder
protected

OHC file format Variables for read and write.

Definition at line 457 of file Openholo.h.


The documentation for this class was generated from the following files: