-
NCNN_FORCEINLINE Mat Mat::channel(int _c)
{
Mat m(w, h, d, (unsigned char*)data + cstep * _c * elemsize, elemsize, elempack, allocator);
m.dims = dims - 1;
if (dims == 4)
m.cstep = (size_t)w * h;
return m;
}
NCNN_FORCEINLINE const Mat Mat::channel(int _c) const
{
Mat m(w, h, d, (unsigned char*)data + cstep * _c * elemsize, elemsize, elempack, allocator);
m.dims = dims - 1;
if (dims == 4)
m.cstep = (size_t)w * h;
return m;
} 还有一个问题:ncnn::Mat怎么从一个float* 构建。谢谢大家 |
Beta Was this translation helpful? Give feedback.
Answered by
nihui
Jun 6, 2022
Replies: 1 comment
-
Mat 有个方法返回任意类型的指针 // access raw data
template<typename T>
operator T*();
template<typename T>
operator const T*() const; |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
mozheng
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Mat 有个方法返回任意类型的指针