CWO++library  0.32
 All Classes Functions Variables Groups
Public Member Functions | Public Attributes | Friends
CWO Class Reference

Top class. More...

#include <cwo.h>

Inheritance diagram for CWO:
GWO

List of all members.

Public Member Functions

void InitParams ()
void InitBuffers ()
 Intialize parameters.
void FreeBuffers ()
 Initialze buffers.
virtual void * __Malloc (size_t size)
 Free buffers.
virtual void __Free (void **a)
virtual void __Memcpy (void *dst, void *src, size_t size)
virtual void __Memset (void *p, int c, size_t size)
virtual void __Expand (void *src, int sx, int sy, int srcNx, int srcNy, void *dst, int dx, int dy, int dstNx, int dstNy, int type)
virtual void __ExpandMirror (cwoComplex *src, int srcNx, int srcNy, cwoComplex *dst, int dstNx, int dstNy, int type)
virtual void __ShiftedFresnelAperture (cwoComplex *a)
virtual void __ShiftedFresnelProp (cwoComplex *a)
virtual void __ShiftedFresnelCoeff (cwoComplex *a)
virtual void __ARSSFresnelAperture (cwoComplex *a)
virtual void __ARSSFresnelProp (cwoComplex *a)
virtual void __ARSSFresnelCoeff (cwoComplex *a)
virtual void __FresnelConvProp (cwoComplex *a)
virtual void __FresnelConvCoeff (cwoComplex *a, float const_val=1.0f)
virtual void __FresnelAnalysisTransfer (cwoComplex *a, cwoComplex *b)
virtual void __AngularProp (cwoComplex *a, int flag)
void __AngularLim (float *fx_c, float *fx_w, float *fy_c, float *fy_w)
virtual void __HuygensProp (cwoComplex *a)
virtual void __FresnelFourierProp (cwoComplex *a)
virtual void __FresnelFourierCoeff (cwoComplex *a)
virtual void __FresnelDblAperture (cwoComplex *a, float z1)
virtual void __FresnelDblFourierDomain (cwoComplex *a, float z1, float z2, cwoInt4 *zp)
virtual void __FresnelDblCoeff (cwoComplex *a, float z1, float z2)
virtual void __FFT (void *src, void *dst, int type)
virtual void __IFFT (void *src, void *dst)
virtual void __FFTShift (void *src)
void __Add (cwoComplex *a, float b, cwoComplex *c)
virtual void __Add (cwoComplex *a, const cwoComplex &b, cwoComplex *c)
virtual void __Add (cwoComplex *a, cwoComplex *b, cwoComplex *c)
void __Sub (cwoComplex *a, float b, cwoComplex *c)
virtual void __Sub (cwoComplex *a, const cwoComplex &b, cwoComplex *c)
virtual void __Sub (cwoComplex *a, cwoComplex *b, cwoComplex *c)
void __Mul (cwoComplex *a, float b, cwoComplex *c)
virtual void __Mul (cwoComplex *a, const cwoComplex &b, cwoComplex *c)
virtual void __Mul (cwoComplex *a, cwoComplex *b, cwoComplex *c)
void __Div (cwoComplex *a, float b, cwoComplex *c)
virtual void __Div (cwoComplex *a, const cwoComplex &b, cwoComplex *c)
virtual void __Div (cwoComplex *a, cwoComplex *b, cwoComplex *c)
void __Rep (cwoComplex *a, float b, cwoComplex *c)
virtual void __Rep (cwoComplex *a, const cwoComplex &b, cwoComplex *c)
virtual void __Rep (cwoComplex *a, cwoComplex *b, cwoComplex *c)
virtual void __Re (cwoComplex *a, cwoComplex *b)
virtual void __Im (cwoComplex *a, cwoComplex *b)
virtual void __Conj (cwoComplex *a)
virtual void __Intensity (cwoComplex *a, cwoComplex *b)
virtual void __Amp (cwoComplex *a, cwoComplex *b)
virtual void __Phase (cwoComplex *a, cwoComplex *b, float offset)
virtual void __Arg (cwoComplex *a, cwoComplex *b, float scale, float offset)
virtual void __Real2Complex (float *src, cwoComplex *dst)
virtual void __Phase2Complex (float *src, cwoComplex *dst)
virtual void __Arg2Cplx (cwoComplex *src, cwoComplex *dst, float scale, float offset)
virtual void __Polar (float *amp, float *ph, cwoComplex *c)
virtual void __ReIm (cwoComplex *re, cwoComplex *im, cwoComplex *c)
virtual void __RectFillInside (cwoComplex *p, int m, int n, int Sx, int Sy, cwoComplex a)
virtual void __RectFillOutside (cwoComplex *p, int m, int n, int Sx, int Sy, cwoComplex a)
virtual void __FloatToChar (char *dst, float *src, int N)
virtual void __CharToFloat (float *dst, char *src, int N)
void FromChar (const char *src, int Nx, int Ny)
void FromFloat (const float *src, int Nx, int Ny)
void SetSize (int Nx, int Ny)
void SetPropDist (float z)
float GetPropDist ()
 CWO ()
 constructor
virtual ~CWO ()
 Constructor with size.
 CWO (CWO &tmp)
 copy constructor
 CWO (int Nx, int Ny)
 constructor
CWOoperator= (CWO &tmp)
CWOoperator= (float a)
CWOoperator= (const cwoComplex &a)
template<class T = CWO>
operator+ (T &a)
template<class T = CWO>
operator+ (float a)
template<class T = CWO>
operator+ (const cwoComplex &a)
template<class T = CWO>
operator- (T &a)
template<class T = CWO>
operator- (float a)
template<class T = CWO>
operator- (const cwoComplex &a)
template<class T = CWO>
operator* (T &a)
template<class T = CWO>
operator* (float a)
template<class T = CWO>
operator* (const cwoComplex &a)
template<class T = CWO>
operator/ (T &a)
template<class T = CWO>
operator/ (float a)
template<class T = CWO>
operator/ (const cwoComplex &a)
CWOoperator+= (CWO &const a)
CWOoperator+= (float a)
CWOoperator+= (cwoComplex a)
CWOoperator-= (CWO &a)
CWOoperator-= (float a)
CWOoperator-= (cwoComplex a)
CWOoperator*= (CWO &a)
CWOoperator*= (float a)
CWOoperator*= (cwoComplex a)
CWOoperator/= (CWO &a)
CWOoperator/= (float a)
CWOoperator/= (cwoComplex a)
virtual void Send (CWO &a)
 Send data to GPU.
virtual void Recv (CWO &a)
 Receive data from GPU.
int Create (int Nx, int Ny=1)
 Create complex amplitude with Nx x Ny size.
virtual void Destroy ()
 Release complex amplitude with Nx x Ny size (in pixel unit) from memory.
void Attach (cwoCtx *ctx, cwoComplex *p)
void SetTimer ()
 Start time mesurement.
double EndTimer ()
 End time mesurement.
void SetCtx (const cwoCtx &c)
 Set context which manages the parameters of the wavelength, pixel pitch, etc.
cwoCtx & GetCtx ()
 Get context which manages the parameters of the wavelength, pixel pitch, etc.
void SetCalcType (int type)
 Set diffraction type. Do not use it.
void SetPitch (float px, float py)
 Set the sampling rate on source and destination planes.
void SetPitch (float p)
void SetPitch (const cwoFloat2 &p)
void SetPitch (const cwoVect2< float > &p)
void SetSrcPitch (float px, float py)
 Set the sampling rate on source plane only.
void SetSrcPitch (float p)
void SetSrcPitch (const cwoFloat2 &p)
void SetSrcPitch (const cwoVect2< float > &p)
void SetDstPitch (float px, float py)
 Set the sampling rate on destination plane only.
void SetDstPitch (float p)
void SetDstPitch (const cwoFloat2 &p)
void SetDstPitch (const cwoVect2< float > &p)
void SetWaveLength (float w)
 Set the wavelength of light.
void SetOffset (float x, float y)
 Set the offset of source plane away from the origin.
void SetOffset (const cwoFloat2 &p)
void SetOffset (const cwoVect2< float > &p)
void SetSrcOffset (float x, float y)
 Set the offset of source plane away from the origin.
void SetSrcOffset (const cwoFloat2 &p)
void SetSrcOffset (const cwoVect2< float > &p)
void SetDstOffset (float x, float y)
 Set the offset of destination plane away from the origin.
void SetDstOffset (const cwoFloat2 &p)
void SetDstOffset (const cwoVect2< float > &p)
void SetThreads (int Nx, int Ny=1)
 set the number of threads
int GetThreads ()
 get the number of threads
size_t GetNx ()
 get horizontal pixel number
size_t GetNy ()
 get vertical pixel number
cwoVect2< size_t > GetShape ()
 get horizontal and vertical pixel number
float GetWaveLength ()
 get wavelength
float GetWaveNum ()
 get wave number
float GetDistance ()
 get propagation distance
float GetPx ()
 get sampling rate along to x-axis on source plane
float GetPy ()
 get sampling rate along to y-axis on source plane
cwoVect2< float > GetPitch ()
float GetSrcPx ()
 get sampling rate along to x-axis on source plane
float GetSrcPy ()
 get sampling rate along to y-axis on source plane
cwoVect2< float > GetSrcPitch ()
float GetDstPx ()
 get sampling rate along to x-axis on destination plane
float GetDstPy ()
 get sampling rate along to y-axis on destination plane
cwoVect2< float > GettDstPitch ()
float GetOx ()
 get offset along to x-axis on source plane
float GetOy ()
 get offset along to y-axis on source plane
cwoVect2< float > GetOffset ()
float GetSrcOx ()
 get offset along to x-axis on source plane
float GetSrcOy ()
 get offset along to y-axis on source plane
cwoVect2< float > GetSrcOffset ()
float GetDstOx ()
 get offset along to x-axis on destination plane
float GetDstOy ()
 get offset along to y-axis on destination plane
cwoVect2< float > GetDstOffset ()
float GetLx ()
 get physical length of source along to x-axis
float GetLy ()
 get physical length of source along to y-axis
cwoVect2< float > GetLength ()
float GetSrcLx ()
 get physical length of source along to x-axis
float GetSrcLy ()
 get physical length of source along to y-axis
cwoVect2< float > GetSrcLength ()
float GetDstLx ()
 get physical length of destication along to x-axis
float GetDstLy ()
 get physical length of destication along to y-axis
cwoVect2< float > GetDstLength ()
cwoVect2< int > GetCenterPix ()
int GetAliasingFreeApproxSphWave (float z, float p, float wl)
 get aliasing-free radius of approximated spherical wave
void ShowParam ()
 Show parameters of cwoCtx.
int CheckExt (const char *fname, const char *ext)
int Load (const std::string &fname, int c=CWO_GREY)
 Load image file or cwo file.
int Load (const std::string &fname_amp, const std::string &fname_pha, int c=CWO_GREY)
 Load image file or cwo file.
int Save (const std::string &fname, int bmp_8_24=24)
 Save image file or cwo file.
int Save (const std::string &fname, CWO *r, CWO *g=nullptr, CWO *b=nullptr)
int SaveMonosToColor (const std::string &fname, const std::string &r_name, const std::string &g_name, const std::string &b_name)
int SaveAsImage (const std::string &fname, float i1, float i2, float o1, float o2, int flag=CWO_SAVE_AS_RE, int bmp_8_24=24)
int SaveAsImage (const std::string &fname, int flag=CWO_SAVE_AS_RE, int bmp_8_24=24)
virtual int SaveAsImage (cwoComplex *p, int Nx, int Ny, const std::string &fname, int flag=CWO_SAVE_AS_RE, int bmp_8_24=24)
int SaveLineAsText (const std::string &fname, int flag)
int SaveLineAsText (const std::string &fname, int flag, int x1, int y1, int x2, int y2)
cwoComplexGetBuffer ()
 Get pointer to the buffer of the complex amplitude.
int CmpCtx (cwoCtx &a, cwoCtx &b)
size_t GetMemSizeCplx ()
 Get required memory with Nx x Ny size in cwoComplex.
size_t GetMemSizeFloat ()
 Get required memory with Nx x Ny size in float.
size_t GetMemSizeChar ()
 Get required memory with Nx x Ny size in char.
int GetDfrExpand ()
 Calculate diffraction.
void SetDfrExpand (int flag=0)
void Diffract (float d, int type=CWO_ANGULAR, cwoInt4 *zp=nullptr, cwoComplex *knl_mask=nullptr, CWO *numap=nullptr)
void Diffract (float d, int type, CWO *tmp_buf)
void Diffract (int type, CWO *kernel[])
void DiffractConv (float d, int type, cwoComplex *ape, cwoComplex *prop, cwoInt4 *zp=nullptr, cwoComplex *knl_mask=nullptr, CWO *numap=nullptr, int prop_calc=1)
void DiffractFourier (float d, int type, cwoInt4 *zp=NULL)
void DiffractDirect (float d, CWO *snumap, CWO *dnumap)
void DiffractAffine (float *affine_mat, int interpolation=CWO_INTER_LINEAR)
 diffraction with affine matrix
void DiffractDepth (float z, float dz, int num, const char *path, const char *name, const char *ext, int type=CWO_ANGULAR)
void AngularProp (CWO *a)
void ShiftedAngularProp (CWO *a)
void FresnelConvProp (CWO *a)
void FresnelConvCoeff (CWO *a)
void ShiftedFresnelProp (CWO *a)
void ShiftedFresnelAperture (CWO *a)
void ShiftedFresnelCoeff (CWO *a)
void ARSSFresnelProp (CWO *a)
void ARSSFresnelAperture (CWO *a)
void ARSSFresnelCoeff (CWO *a)
void FresnelFourierProp (CWO *a)
void FresnelFourierCoeff (CWO *a)
void FresnelDblAperture (CWO *a, float z1)
void FresnelDblFourierDomain (CWO *a, float z1, float z2, cwoInt4 *zp)
void FresnelDblCoeff (CWO *a, float z1, float z2)
void FresnelDupProp (CWO *a, float M)
void PreDiffract (float z, int type, CWO *a[])
void ReleaseTmpBuffer ()
void FresnelCoeff (float z1, float z2, float wl1, float wl2)
float fresnel_c (float x)
float fresnel_s (float x)
void FresnelInt (float z, int x1, int y1, int x2, int y2)
virtual void __AddSphericalWave (cwoComplex *p, float x, float y, float z, float px, float py, float a, float ph=0.0f)
virtual void __MulSphericalWave (cwoComplex *p, float x, float y, float z, float px, float py, float a)
void AddSphericalWave (float x, float y, float z, float a, float ph=0.0f)
void AddSphericalWave (float x, float y, float z, float px, float py, float a, float ph=1.0f)
 Add spherical wave to the field.
void MulSphericalWave (float x, float y, float z, float a=1.0f)
 Multiply spherical wave to the field.
void MulSphericalWave (float x, float y, float z, float px, float py, float a=1.0f)
virtual void __AddApproxSphWave (cwoComplex *p, float x, float y, float phi, float zx, float zy, float px, float py, float a)
 Add Fresnel-approximated spherical wave to the field.
void AddApproxSphWave (float x, float y, float z, float a=1.0f)
void AddApproxSphWave (float x, float y, float z, float px, float py, float a=1.0f)
void AddApproxSphWave (float x, float y, float phi, float zx, float zy, float px, float py, float a=1.0f)
virtual void __MulApproxSphWave (cwoComplex *p, float x, float y, float phi, float zx, float zy, float px, float py, float a)
 Multiply Fresnel-approximated spherical wave to the field.
void MulApproxSphWave (float x, float y, float z, float a=1.0f)
void MulApproxSphWave (float x, float y, float z, float px, float py, float a=1.0f)
void MulApproxSphWave (float x, float y, float phi, float zx, float zy, float px, float py, float a=1.0f)
void AddPlanarWave (float kx, float ky, float px, float py, float a=1.0f)
 Add planar wave to the field.
void AddPlanarWave (float kx, float ky, float a=1.0f)
 Add planar wave to the field.
void MulPlanarWave (float kx, float ky, float px, float py, float a=1.0f)
 Multiply planar wave to the field.
void MulPlanarWave (float kx, float ky, float a=1.0f)
 Multiply planar wave to the field.
void Re ()
 Taking only the real part of complex amplitude.
void Im ()
 Taking only the imaginary part of complex amplitude.
void Conj ()
 Calculating the complex conjugation of complex amplitude.
void Intensity ()
 Calculating the absolute square (light intensity) of complex amplitude.
void Amp ()
 Calculating the amplitude of complex amplitude.
void Phase (float offset=0.0f)
 Calculating complex amplitude with the constant amplitude .
void Arg (float scale=1.0f, float offset=0.0f)
 Calculating the argument of complex amplitude with real value from $-\pi$ to $+\pi$.
.
void Expi ()
void Arg2Cplx (float scale=1.0, float offset=0.0)
void Cart2Polar ()
void Polar2Cart ()
void ReIm (CWO &re, CWO &im)
 replace the real and imaginary parts.

void Char ()
void Float ()
void Quant (float alpha)
void ToDouble (double *a)
void FromDouble (double *a)
virtual void SqrtReal ()
 Take the square root of only the real part of the complex amplitude field.
virtual void SqrtCplx ()
 Take the square root of the amplitude of the complex amplitude field.
void Div (float a)
cwoComplex Polar (float amp, float arg)
void SetPixel (int x, int y, float a)
void SetPixel (const cwoVect2< int > &v, float a)
void SetPixel (int x, int y, float amp, float ph)
void SetPixel (const cwoVect2< int > &v, float amp, float ph)
void SetPixel (int x, int y, cwoComplex &a)
void SetPixel (const cwoVect2< int > &v, cwoComplex &a)
void SetPixel (int x, int y, CWO &a)
void SetPixel (const cwoVect2< int > &v, CWO &a)
void AddPixel (int x, int y, cwoComplex a)
void AddPixel (const cwoVect2< int > &v, cwoComplex a)
void AddPixel (int x, int y, CWO &a)
void AddPixel (const cwoVect2< int > &v, CWO &a)
void MulPixel (int x, int y, float a)
void MulPixel (const cwoVect2< int > &v, float a)
void MulPixel (int x, int y, cwoComplex a)
void MulPixel (const cwoVect2< int > &v, cwoComplex a)
void GetPixel (int x, int y, float &a)
void GetPixel (const cwoVect2< int > &v, float &a)
void GetPixel (int x, int y, cwoComplex &a)
void GetPixel (const cwoVect2< int > &v, cwoComplex &a)
cwoComplex GetPixel (int m, int n)
cwoComplex GetPixel (const cwoVect2< int > &v)
void GetPixel (int x, int y, CWO &a)
void GetPixel (const cwoVect2< int > &v, CWO &a)
void GetLineH (int n, int N, CWO &a)
void GetLineV (int m, int N, CWO &a)
void GetLine (int m1, int n1, int m2, int n2, CWO &a)
void SetLineH (int n, CWO &a)
void SetLineV (int m, CWO &a)
void SetLine (int m1, int n1, int m2, int n2, CWO &a)
virtual void __Copy (cwoComplex *src, int x1, int y1, int sNx, int sNy, cwoComplex *dst, int x2, int y2, int dNx, int dNy, int Sx, int Sy)
void Copy (CWO &a, int x1, int y1, int x2, int y2, int Sx, int Sy)
void Clear (int c=0)
virtual void Fill (cwoComplex a)
template<class T >
void FlipH (T *a)
template<class T >
void FlipV (T *a)
void Flip (int mode=0)
void Crop (int x1, int y1, int Sx, int Sy)
void Crop (const cwoVect2< int > &v, const cwoVect2< int > &s)
void Crop (int x1, int y1, int Sx, int Sy, CWO &a)
void Crop (const cwoVect2< int > &v, const cwoVect2< int > &s, CWO &a)
void ShiftX (int s, int flag=0)
void ShiftY (int s, int flag=0)
void Transpose ()
virtual void __Transpose (cwoComplex *pi, cwoComplex *po)
void JoinH (CWO &a)
void JoinV (CWO &a)
void Rect (int m, int n, int Sx, int Sy, cwoComplex &a, int flag=CWO_FILL_INSIDE)
 fill inside and outside rectangular area
void Rect (const cwoVect2< int > &v, const cwoVect2< int > &s, cwoComplex &a, int flag=CWO_FILL_INSIDE)
void Circ (int m, int n, int r, cwoComplex &a, int flag=CWO_FILL_INSIDE)
 fill inside or outside circular area with radius r
void Circ (const cwoVect2< int > &v, int r, cwoComplex &a, int flag=CWO_FILL_INSIDE)
virtual void __CircFillInside (cwoComplex *p, int m, int n, int r, cwoComplex &a)
virtual void __CircFillOutside (cwoComplex *p, int m, int n, int r, cwoComplex &a)
void MulCirc (int m, int n, int r, cwoComplex &a)
 multiply complex value in circular area
void MulCirc (const cwoVect2< int > &v, int r, cwoComplex &a)
void Convolve (CWO &a, float *ker, int Sx, int Sy)
void ConvolveFFT (CWO *a, CWO *b, CWO *c)
virtual void Expand (int Nx, int Ny)
void ExpandMirror ()
void ExpandTwice (CWO *src)
void ExpandHalf (CWO *dst)
int ScaleReal (float lim=1.0)
 scale current pixels (real part of complex amplitude) by specified maximum value
int ScaleReal (float i1, float i2, float o1, float o2)
 scale real part of complex amplitude by specified range
virtual int __ScaleReal (float i1, float i2, float o1, float o2)
int ScaleCplx (float lim=1.0)
 scale complex amplitude by specified maximum value
int ScaleCplx (float i1, float i2, float o1, float o2)
 scalecomplex amplitude by specified range
virtual int __ScaleCplx (float i1, float i2, float o1, float o2)
virtual void SetRandSeed (long long int s)
 set the seed of random sequence to generate other
long long int GetRandSeed ()
float GetRandVal ()
 get random value
cwoComplex GetRandComplex ()
virtual void __RandPhase (cwoComplex *a, float max, float min)
virtual void __MulRandPhase (cwoComplex *a, float max, float min)
virtual void RandReal (float max=1.0f, float min=0.0f)
void RandPhase (float max=CWO_PI, float min=-CWO_PI)
void SetRandPhase (float max=CWO_PI, float min=-CWO_PI)
void MulRandPhase (float max=CWO_PI, float min=-CWO_PI)
void __Hanning (cwoComplex *a, int m, int n, int Wx, int Wy)
 Hanning window.
void __Hamming (cwoComplex *a, int m, int n, int Wx, int Wy)
 Hamming window.
void __WindowCos (cwoComplex *a, int m, int n, int W, int Wa)
void __WindowTukey (cwoComplex *a, int m, int n, float r)
 Tukey window.
virtual void __WindowFlatCos (cwoComplex *p, int L, int L0, float k)
 Windoww function (flatheadded cos window)
void __WindowFlatCosCirc (cwoComplex *p, int L, int L0, float k)
void __WindowSigmoid (cwoComplex *p, int m, int n, float a, float Tmax, float Tmin)
 Sigmoid window.
virtual void __ResizeNearest (cwoComplex *p_new, int newNx, int newNy, cwoComplex *p_old, int oldNx, int oldNy)
virtual void __ResizeLinear (cwoComplex *p_new, int newNx, int newNy, cwoComplex *p_old, int oldNx, int oldNy)
virtual void __ResizeCubic (cwoComplex *p_new, int newNx, int newNy, cwoComplex *p_old, int oldNx, int oldNy)
virtual void __ResizeLanczos (cwoComplex *p_new, int newNx, int newNy, cwoComplex *p_old, int oldNx, int oldNy)
virtual void __ResizeNearestScale (cwoComplex *p_src, cwoComplex *p_dst, float scale_x, float scale_y)
virtual void __ResizeLinearScale (cwoComplex *p_src, cwoComplex *p_dst, float scale_x, float scale_y)
virtual void __ResizeCubicScale (cwoComplex *p_src, cwoComplex *p_dst, float scale_x, float scale_y)
virtual void __ResizeLanczosScale (cwoComplex *p_src, cwoComplex *p_dst, float scale_x, float scale_y)
void AddNoiseWhite (float max=1.0)
void MulNoiseWhite (float max=1.0)
void AddNoiseGaussian (float mu, float sigma)
void MulNoiseGaussian (float mu, float sigma)
void Resize (int dNx, int dNy, int flag=CWO_INTER_LINEAR)
 resize an image

void Resize (const cwoVect2< int > &s, int flag=CWO_INTER_LINEAR)
void Resize (CWO *dst, float scale_x, float scale_y, int flag=CWO_INTER_LINEAR)
void Rotate (float deg)
virtual void AffineAngularSpectrum (float *mat_affine, float px, float py, int flag=CWO_INTER_LINEAR)
void AffineAngularSpectrum (float *mat_affine, const cwoVect2< float > &pitch, int flag=CWO_INTER_LINEAR)
virtual void ErrorDiffusion (CWO *a=nullptr, int flag=CWO_ED_FS)
virtual void ErrorDiffusionSegmented (CWO *output, int flag=CWO_ED_FS)
void RGB2YCbCr (CWO *rgb, CWO *ycbcr)
void YCbCr2RGB (CWO *rgb, CWO *ycbcr)
void MulMatrix (CWO *a, cwoComplex *b, CWO *c)
void FourierShift (float m, float n)
int FFT (int flag=0)
 Fast Fourier Transform (FFT)
virtual void FFTShift ()
 FFT Shift.
int FFT (int dx, int dy, int flag=0)
 Fast Fourier Transform (FFT)
virtual void FFTShift (int dx, int dy)
 FFT Shift.
virtual void __ScaledFFTCoeff (cwoComplex *p, float sx, float sy, cwoComplex alpha)
virtual void __ScaledFFTKernel (cwoComplex *p, float sx, float sy, cwoComplex alpha)
virtual void __NUFFT_T1 (cwoComplex *p_fld, cwoFloat2 *p_x, int R=2, int Msp=12)
virtual void __NUFFT_T2 (cwoComplex *p_fld, cwoFloat2 *p_x, int R=2, int Msp=12)
void NUFFT1 (CWO *map, int R=2, int Msp=12)
 Non-uniform FFT (Type1)
void NUFFT2 (CWO *map, int R=2, int Msp=12)
 Non-uniform FFT (Type2)
void ConvertSamplingMap (int type)
void SamplingMapScaleOnly (int Nx, int Ny, float R, float sgn)
virtual void Log (float base=10.0f, float eps=1.0f)
virtual void Gamma (float g)
virtual void Threshold (float max, float min=0.0)
virtual void Threshold (float max_th, float max_val, float min_th, float min_val)
void ThresholdAmp (float max_amp, float min_amp)
void ThresholdToZero (float th)
void ThresholdAbsToZero (float th)
void ThresholdHist (float var)
virtual void Binary (float th=0.0, float max=1.0, float min=0.0)
virtual void __PickupFloat (float *src, float *pix_p, float pix)
virtual void __PickupCplx (cwoComplex *src, cwoComplex *pix_p, float pix)
void Pickup (CWO *a, float pix)
 Pickup pixels.
int POC (CWO &ref)
 phase only correlation (POC)
unsigned int Count (float a)
unsigned int CountNonZero ()
virtual float Average ()
 calculate the average of the real part
float Average (int m, int n, int Sx, int Sy)
virtual float Variance ()
 calculate the variance of the real part
float Variance (int m, int n, int Sx, int Sy)
float StdDev (int m, int n, int Sx, int Sy)
 calculate the standard deviation
virtual void __MaxMin (cwoComplex *a, float *max, float *min, int *max_x=nullptr, int *max_y=nullptr, int *min_x=nullptr, int *min_y=nullptr)
float Max (int *m=NULL, int *n=NULL)
 find maximum of the real part
float Min (int *m=NULL, int *n=NULL)
 find minimum of the real part
int MaxMin (float *max, float *min, int *max_x=nullptr, int *max_y=nullptr, int *min_x=nullptr, int *min_y=nullptr)
 find maxmum and minimum of the real part
void VarianceMap (int sx, int sy)
 generate variance map
float Histogram (int *hist, int N)
 generate histogram
virtual cwoComplex TotalSum ()
 Calculate total sum of real part.
virtual float MSE (CWO &ref)
 Measure MSE between target and reference images.
float SNR (CWO &ref)
 Measure SNR(Signal to Noise Ratio) between target and reference images.
float PSNR (CWO &ref)
 Measure PSNR between target and reference images.
float SSIM (CWO &ref)
 Measure SSIM between target and reference images.
float SpeckleContrast (int m, int n, int Sx, int Sy)
CWO LaplacianPhase ()
void PoisonSolverFFT ()
void PhaseUnwrap (int type=0)
virtual cwoObjPointGetPointBuffer ()
virtual int GetPointNum ()
virtual void SetPointNum (int num)
virtual void ScalePoint (float lim)
void PLS (int flag)
virtual void __PLS_Huygens (float ph=0.0f)
virtual void __PLS_Fresnel (float ph=0.0f)
virtual void __PLS_CGH_Fresnel (float ph=0.0f)
virtual void __InvFx2Fy2 (cwoComplex *a)
void ParticleField (cwoFloat3 pos, float radius, float amp=1.0f, float init_ph=0.0f)
 Complex amplitude from particle with radius.

Public Attributes

cwoCtx ctx
long long int rnd_seed
void * p_field
float z0
float pz

Friends

template<class T >
CWO operator+ (const T &a, CWO &c)
template<class T >
CWO operator- (const T &a, CWO &c)
template<class T >
CWO operator* (const T &a, CWO &c)
template<class T >
CWO operator/ (const T &a, CWO &c)

Detailed Description

Top class.

This class is top class of CWO++ library

Examples:
Amplitude CGH, Kinoform, Phase shifting digital holography, Shifted-Fresnel diffraction, simple_diffraction.cpp, simple_diffraction_with_gpu.cpp, and Using CPU threads.

Member Function Documentation

int CWO::Create ( int  Nx,
int  Ny = 1 
)

Create complex amplitude with Nx x Ny size.

Parameters:
Nx: x size (unitless)
Ny: y size (unitless)
virtual void CWO::__WindowFlatCos ( cwoComplex p,
int  L,
int  L0,
float  k 
)
virtual

Windoww function (flatheadded cos window)

Note:
see Yancao Zhang, Jianlin Zhao, Qi Fan, Wei Zhang, and Sheng Yang, "Improving the reconstruction quality with extension and apodization of the digital hologram," Appl. Opt. 48, 3070-3074 (2009)

Reimplemented in GWO.

void CWO::Pickup ( CWO a,
float  pix 
)

Pickup pixels.

if a(m,n)=pix , this(m,n)=this(m,n) otherwise this(m,n)=0

Parameters:
a: pointer to source image
pix: pixel value
int CWO::POC ( CWO ref)

phase only correlation (POC)

calculate phase only correlation, then the correlation result is maintained in this instance.

Parameters:
ref: reference image
Returns:
: if success, it returns CWO_SUCCESS, otherwise CWO_ERROR
Note:
The image sizes of the target and reference images should be the same. the traget and ref is destroyed after POC.

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