4 #include <opencv2/opencv.hpp>
19 depth = DataDepth<channel_type>::value,
21 fmt = ((channels - 1)<<8) + DataDepth<channel_type>::fmt,
22 type = CV_MAKETYPE(depth, channels)
35 depth = DataDepth<channel_type>::fmt,
37 fmt = ((channels - 1)<<8) + DataDepth<channel_type>::fmt,
38 type = CV_MAKETYPE(depth, channels)
102 ndarray<Dim, Elem> arr(vw);
107 reinterpret_cast<void*>(arr.start())
109 cv::Mat_<Elem> mat_(mat);
110 cv::Mat_<Elem> mat_copy_;
111 mat_.copyTo(mat_copy_);
118 template<std::
size_t Dim,
typename Elem>
119 bool copy_less_convertible_to_opencv_mat(
const ndarray_view<Dim, Elem>& vw) {
120 return vw.has_default_strides();
125 template<std::
size_t Dim,
typename T>
126 auto to_ndarray_view(
const cv::Mat_<T>& mat) {
127 T* start =
reinterpret_cast<T*
>(mat.data);
128 ndcoord<Dim, int> shape(mat.size.p, mat.size.p + Dim);
129 ndcoord<Dim, std::size_t> strides(mat.step.p, mat.step.p + Dim);
130 return ndarray_view<Dim, T>(start, shape, strides);
YCbCr color, 8 bit.
Definition: color.h:74
Vec< channel_type, channels > vec_type
Definition: opencv.h:40
int work_type
Definition: opencv.h:15
uchar channel_type
Definition: opencv.h:32
uchar channel_type
Definition: opencv.h:16
RGB color, 8 bit.
Definition: color.h:27
Vec< channel_type, channels > vec_type
Definition: opencv.h:24
int work_type
Definition: opencv.h:31