Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

mexConverts.H File Reference


Detailed Description

conversions from ans to MEX arrays

Definition in file mexConverts.H.

#include "Util/Types.H"
#include "Image/Point2D.H"
#include "Image/ImageSet.H"
#include <mex.h>
#include <vector>

Include dependency graph for mexConverts.H:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  MexReturn
 Class to help manage return values in mex files. More...

Functions

template<class T>
Image< T > mexArray2Image (const mxArray *arrptr)
 convert a mxArray into a grayscale image
template<class T>
Image< PixRGB< T > > mexArray2RGBImage (const mxArray *arrptr)
 convert a mxArray into a RGB image
template<class T>
mxArrayImage2mexArray (const Image< T > &img)
 convert a grayscale image into a mxArray
mxArrayImage2mexArrayUint8 (const Image< byte > *img)
 convert a grayscale image into a mxArray of class 'uint8'
template<class T>
mxArrayRGBImage2mexArray (const Image< PixRGB< T > > &img)
 convert a RGB image into a mxArray of class 'double'
mxArrayRGBImage2mexArrayUint8 (const Image< PixRGB< byte > > *img)
 convert a RGB image into a mxArray of class 'uint8'
template<class T>
std::vector< T > mexArr2Vector (const mxArray *vecptr, uint num_elements)
 convert the first num_elements elements of a mxArray into a std::vector
template<class T>
std::vector< T > mexArr2Vector (const mxArray *vecptr)
 convert a mxArray vector into a std::vector
template<class T>
mxArrayVector2mexArr (const std::vector< T > &vect, uint num_elements)
 convert the first num_elements elements of a std::vector into a mxArray
template<class T>
mxArrayVector2mexArr (const std::vector< T > &vect)
 convert a std::vector into a mxArray vector
std::vector< Point2D< int > > mexArr2Point2DVec (const mxArray *arrptr)
 convert a 2 x N mxArray into a std::vector<Point2D<int> >
mxArrayPoint2DVec2mexArr (const std::vector< Point2D< int > > &vect)
 convert a std::vector<Point2D<int> > into a 2 x N mxArray
template<class T>
mxArrayImgVec2mexArr (const ImageSet< T > &vect)
 convert a vector of pointers to images of equal size into a 3D mxArray
template<class T>
ImageSet< T > mexArr2ImgVec (const mxArray *arrptr)
 convert a 3D mxArray into a vector of pointers to images of equal size
template<class T>
mxArrayImageSet2cellArr (const ImageSet< T > &imset)
 convert an ImageSet into a cell array of images
template<class T>
ImageSet< T > cellArr2ImageSet (const mxArray *arrptr)
 convert a cell array of images into an ImageSet
template<class T>
mxArrayImageSetVec2cellArr (const std::vector< ImageSet< T > > &vec)
 convert a vector of ImageSet into a 2d cell array
template<class T>
std::vector< ImageSet< T > > cellArr2ImageSetVec (const mxArray *arrptr)
 convert a 2d cell array into a vector of ImageSet
double conv (const double *src, double *target)
byte conv (const double *src, byte *target)
double conv (const byte *src, double *target)
byte conv (const byte *src, byte *target)
float conv (const double *src, float *target)
double conv (const float *src, double *target)
float conv (const byte *src, float *target)


Function Documentation

template<class T>
ImageSet<T> cellArr2ImageSet const mxArray arrptr  ) 
 

convert a cell array of images into an ImageSet

Definition at line 496 of file mexConverts.C.

References i, and mexFatal().

template<class T>
std::vector< ImageSet<T> > cellArr2ImageSetVec const mxArray arrptr  ) 
 

convert a 2d cell array into a vector of ImageSet

Definition at line 530 of file mexConverts.C.

References mexFatal(), mxGetM(), and mxGetN().

template<class T>
mxArray* Image2mexArray const Image< T > &  img  ) 
 

convert a grayscale image into a mxArray

Definition at line 172 of file mexConverts.C.

References Image< T >::begin(), conv(), Image< T >::getHeight(), Image< T >::getSize(), Image< T >::getWidth(), height, mxCreateDoubleMatrix(), mxGetPr(), mxREAL, width, x, and y.

Referenced by ImageSet2cellArr(), ImageSetVec2cellArr(), mexFunction(), and MexReturn::store().

mxArray* Image2mexArrayUint8 const Image< byte > *  img  ) 
 

convert a grayscale image into a mxArray of class 'uint8'

We take a pointer rather than a reference to ensure that there are no implicit Image type conversions in calls to this function -- we want exactly an Image<byte>, and not an Image<float> or some other pixel type.

template<class T>
mxArray* ImageSet2cellArr const ImageSet< T > &  imset  ) 
 

convert an ImageSet into a cell array of images

Definition at line 483 of file mexConverts.C.

References i, Image2mexArray(), and ImageSet< T >::size().

template<class T>
mxArray* ImageSetVec2cellArr const std::vector< ImageSet< T > > &  vec  ) 
 

convert a vector of ImageSet into a 2d cell array

Definition at line 511 of file mexConverts.C.

References Image2mexArray().

template<class T>
mxArray* ImgVec2mexArr const ImageSet< T > &  vect  ) 
 

convert a vector of pointers to images of equal size into a 3D mxArray

Definition at line 364 of file mexConverts.C.

References conv(), i, ImageSet< T >::isEmpty(), mexFatal(), mxGetPr(), mxREAL, ImageSet< T >::size(), src, x, and y.

Referenced by mexFunction().

template<class T>
ImageSet<T> mexArr2ImgVec const mxArray arrptr  ) 
 

convert a 3D mxArray into a vector of pointers to images of equal size

Definition at line 400 of file mexConverts.C.

References conv(), height, mexFatal(), mxGetPr(), NO_INIT, sformat(), src, width, x, and y.

std::vector<Point2D<int> > mexArr2Point2DVec const mxArray arrptr  ) 
 

convert a 2 x N mxArray into a std::vector<Point2D<int> >

Definition at line 327 of file mexConverts.C.

References i, mexFatal(), mxGetM(), mxGetN(), mxGetPr(), and n.

template<class T>
std::vector<T> mexArr2Vector const mxArray vecptr  ) 
 

convert a mxArray vector into a std::vector

Definition at line 297 of file mexConverts.C.

template<class T>
std::vector<T> mexArr2Vector const mxArray vecptr,
uint  num_elements
 

convert the first num_elements elements of a mxArray into a std::vector

Definition at line 280 of file mexConverts.C.

References i, and mxGetPr().

template<class T>
Image<T> mexArray2Image const mxArray arrptr  ) 
 

convert a mxArray into a grayscale image

Definition at line 49 of file mexConverts.C.

References Image< T >::beginw(), conv(), height, mexFatal(), mxGetPr(), NO_INIT, sformat(), width, x, and y.

template<class T>
Image< PixRGB<T> > mexArray2RGBImage const mxArray arrptr  ) 
 

convert a mxArray into a RGB image

Definition at line 104 of file mexConverts.C.

References Image< T >::beginw(), conv(), height, mexFatal(), mxGetPr(), NO_INIT, sformat(), width, x, and y.

mxArray* Point2DVec2mexArr const std::vector< Point2D< int > > &  vect  ) 
 

convert a std::vector<Point2D<int> > into a 2 x N mxArray

template<class T>
mxArray* RGBImage2mexArray const Image< PixRGB< T > > &  img  ) 
 

convert a RGB image into a mxArray of class 'double'

Definition at line 217 of file mexConverts.C.

References conv(), mxGetPr(), mxREAL, x, and y.

Referenced by mexFunction(), and MexReturn::store().

mxArray* RGBImage2mexArrayUint8 const Image< PixRGB< byte > > *  img  ) 
 

convert a RGB image into a mxArray of class 'uint8'

We take a pointer rather than a reference to ensure that there are no implicit Image type conversions in calls to this function -- we want exactly an Image<PixRGB<byte>>, and not an Image<PixRGB<float>> or some other pixel type.

template<class T>
mxArray* Vector2mexArr const std::vector< T > &  vect  ) 
 

convert a std::vector into a mxArray vector

template<class T>
mxArray* Vector2mexArr const std::vector< T > &  vect,
uint  num_elements
 

convert the first num_elements elements of a std::vector into a mxArray


Generated on Mon Nov 23 15:48:35 2009 for iLab Neuromorphic Vision Toolkit by  doxygen 1.4.4