Commit 70068e46 authored by Davis King's avatar Davis King

Added a mat() overload for cv_image.

parent e3743b5f
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "cv_image_abstract.h" #include "cv_image_abstract.h"
#include "../algs.h" #include "../algs.h"
#include "../pixel.h" #include "../pixel.h"
#include "../matrix/matrix_mat.h"
namespace dlib namespace dlib
{ {
...@@ -123,6 +124,21 @@ namespace dlib ...@@ -123,6 +124,21 @@ namespace dlib
long _nc; long _nc;
}; };
// ----------------------------------------------------------------------------------------
template <
typename T
>
const matrix_op<op_array2d_to_mat<cv_image<T> > > mat (
const cv_image<T>& m
)
{
typedef op_array2d_to_mat<cv_image<T> > op;
return matrix_op<op>(op(m));
}
// ----------------------------------------------------------------------------------------
} }
#endif // DLIB_CvIMAGE_H_ #endif // DLIB_CvIMAGE_H_
......
...@@ -229,6 +229,24 @@ namespace dlib ...@@ -229,6 +229,24 @@ namespace dlib
!*/ !*/
}; };
// ----------------------------------------------------------------------------------------
template <
typename T
>
const matrix_exp mat (
const cv_image<T>& img
);
/*!
ensures
- returns a matrix R such that:
- R.nr() == img.nr()
- R.nc() == img.nc()
- for all valid r and c:
R(r, c) == img[r][c]
!*/
// ----------------------------------------------------------------------------------------
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment