
#include "Matlab/mexConverts.H"#include "Image/Image.H"#include "Image/Pixels.H"#include "Matlab/mexLog.H"#include "Util/sformat.H"#include "rutz/shared_ptr.h"
Go to the source code of this file.
| Defines | |
| #define | INSTANTIATE(T) | 
| #define | INSTANTIATE2(T) | 
| 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 > | |
| mxArray * | Image2mexArray (const Image< T > &img) | 
| convert a grayscale image into a mxArray | |
| mxArray * | Image2mexArrayUint8 (const Image< byte > *img) | 
| convert a grayscale image into a mxArray of class 'uint8' | |
| template<class T > | |
| mxArray * | RGBImage2mexArray (const Image< PixRGB< T > > &img) | 
| convert a RGB image into a mxArray of class 'double' | |
| mxArray * | RGBImage2mexArrayUint8 (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 > | |
| mxArray * | Vector2mexArr (const std::vector< T > &vect, uint num_elements) | 
| convert the first num_elements elements of a std::vector into a mxArray | |
| template<class T > | |
| mxArray * | Vector2mexArr (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> > | |
| mxArray * | Point2DVec2mexArr (const std::vector< Point2D< int > > &vect) | 
| convert a std::vector<Point2D<int> > into a 2 x N mxArray | |
| template<class T > | |
| mxArray * | ImgVec2mexArr (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 > | |
| mxArray * | ImageSet2cellArr (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 > | |
| mxArray * | ImageSetVec2cellArr (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 | |
| INSTANTIATE (byte) | |
| INSTANTIATE (float) | |
| template mxArray * | Image2mexArray (const Image< double > &img) | 
| INSTANTIATE2 (byte) | |
| INSTANTIATE2 (float) | |
| INSTANTIATE2 (int) | |
| INSTANTIATE2 (double) | |
conversions from and to MEX arrays
Definition in file mexConverts.C.
| #define INSTANTIATE | ( | T | ) | 
template Image<T> mexArray2Image(const mxArray* arrptr); \ template Image< PixRGB<T> > mexArray2RGBImage(const mxArray* arrptr); \ template mxArray* Image2mexArray(const Image<T>& img); \ template mxArray* RGBImage2mexArray(const Image< PixRGB<T> >& img); \ template mxArray* ImgVec2mexArr(const ImageSet<T>& vect); \ template ImageSet<T> mexArr2ImgVec(const mxArray* arrptr); \ template mxArray* ImageSet2cellArr(const ImageSet<T>& imset); \ template ImageSet<T> cellArr2ImageSet(const mxArray* arrptr); \ template mxArray* ImageSetVec2cellArr(const std::vector< ImageSet<T> >& vec); \ template std::vector< ImageSet<T> > cellArr2ImageSetVec(const mxArray* arrptr); \ template bool MexReturn::store(int num, const Image<T>& val); \ template bool MexReturn::store(int num, const Image< PixRGB<T> >& val); \
Definition at line 627 of file mexConverts.C.
| #define INSTANTIATE2 | ( | T | ) | 
template std::vector<T> mexArr2Vector(const mxArray* vecptr, uint num_elements); \ template std::vector<T> mexArr2Vector(const mxArray* vecptr); \ template mxArray* Vector2mexArr(const std::vector<T>& vect, uint num_elements); \ template mxArray* Vector2mexArr(const std::vector<T>& vect); \ template bool MexReturn::store(int num, const std::vector<T>& val); \
Definition at line 648 of file mexConverts.C.
| ImageSet<T> cellArr2ImageSet | ( | const mxArray * | arrptr | ) |  [inline] | 
convert a cell array of images into an ImageSet
Definition at line 496 of file mexConverts.C.
References mexFatal().
| std::vector< ImageSet<T> > cellArr2ImageSetVec | ( | const mxArray * | arrptr | ) |  [inline] | 
convert a 2d cell array into a vector of ImageSet
Definition at line 530 of file mexConverts.C.
References mexFatal().
| mxArray* Image2mexArray | ( | const Image< T > & | img | ) |  [inline] | 
convert a grayscale image into a mxArray
Definition at line 172 of file mexConverts.C.
References Image< T >::begin(), Image< T >::getHeight(), Image< T >::getSize(), Image< T >::getWidth(), and height.
Referenced by ImageSet2cellArr(), ImageSetVec2cellArr(), mexFunction(), and MexReturn::store().
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.
Definition at line 194 of file mexConverts.C.
References Image< T >::begin(), Image< T >::getHeight(), Image< T >::getWidth(), and height.
Referenced by mexFunction().
| mxArray* ImageSet2cellArr | ( | const ImageSet< T > & | imset | ) |  [inline] | 
convert an ImageSet into a cell array of images
Definition at line 483 of file mexConverts.C.
References Image2mexArray(), and ImageSet< T >::size().
| mxArray* ImageSetVec2cellArr | ( | const std::vector< ImageSet< T > > & | vec | ) |  [inline] | 
convert a vector of ImageSet into a 2d cell array
Definition at line 511 of file mexConverts.C.
References Image2mexArray().
| mxArray* ImgVec2mexArr | ( | const ImageSet< T > & | vect | ) |  [inline] | 
convert a vector of pointers to images of equal size into a 3D mxArray
Definition at line 364 of file mexConverts.C.
References ImageSet< T >::isEmpty(), mexFatal(), and ImageSet< T >::size().
| ImageSet<T> mexArr2ImgVec | ( | const mxArray * | arrptr | ) |  [inline] | 
convert a 3D mxArray into a vector of pointers to images of equal size
Definition at line 400 of file mexConverts.C.
References height, mexFatal(), NO_INIT, and sformat().
| 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 mexFatal().
| std::vector<T> mexArr2Vector | ( | const mxArray * | vecptr | ) |  [inline] | 
convert a mxArray vector into a std::vector
Definition at line 297 of file mexConverts.C.
| std::vector<T> mexArr2Vector | ( | const mxArray * | vecptr, | |
| uint | num_elements | |||
| ) |  [inline] | 
convert the first num_elements elements of a mxArray into a std::vector
Definition at line 280 of file mexConverts.C.
| Image<T> mexArray2Image | ( | const mxArray * | arrptr | ) |  [inline] | 
convert a mxArray into a grayscale image
Definition at line 49 of file mexConverts.C.
References Image< T >::beginw(), height, mexFatal(), NO_INIT, and sformat().
convert a mxArray into a RGB image
Definition at line 104 of file mexConverts.C.
References Image< T >::beginw(), height, mexFatal(), NO_INIT, and sformat().
| mxArray* Point2DVec2mexArr | ( | const std::vector< Point2D< int > > & | vect | ) | 
convert a std::vector<Point2D<int> > into a 2 x N mxArray
Definition at line 349 of file mexConverts.C.
convert a RGB image into a mxArray of class 'double'
Definition at line 217 of file mexConverts.C.
Referenced by mexFunction(), and MexReturn::store().
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.
Definition at line 246 of file mexConverts.C.
Referenced by mexFunction().
| mxArray* Vector2mexArr | ( | const std::vector< T > & | vect | ) |  [inline] | 
convert a std::vector into a mxArray vector
Definition at line 321 of file mexConverts.C.
References Vector2mexArr().
| mxArray* Vector2mexArr | ( | const std::vector< T > & | vect, | |
| uint | num_elements | |||
| ) |  [inline] | 
convert the first num_elements elements of a std::vector into a mxArray
Definition at line 304 of file mexConverts.C.
References mexFatal(), and sformat().
Referenced by MexReturn::store(), and Vector2mexArr().
 1.6.3
 1.6.3