其中cv::Mat是显式定义的构造函数
Where are cv::Mat constructors explicitly defined?
[1]在哪里cv::Mat数据结构构造函数明确(在C/c++)定义在OpenCV源代码?
我假设cv::Mat数据结构是动态分配给堆的,当像
这样的东西 cv::Mat mat(rows, cols, type);
,但在
中找不到ANSI C或c++实现。 opencv / modules / core / src / matrix.cpp
nor in
opencv / modules / core / src / datastructs.cpp
.
SOLVED: cv::Mat
在matrix.cpp中分配了一个fastMalloc()
。这是在cv::Mat:create()
函数中执行的。
[2]此外,我很想知道当执行图像处理操作时,cv::Mat将位于硬件中的哪个位置:
。总是在'主存' (SDRAM),
。总是在片上缓存(SRAM)中,
。或者两者的结合?
cv::Mat Mat (rows, cols, type);
这是内联构造函数,它在core/mat.hpp
中实现:
inline Mat::Mat(int _rows, int _cols, int _type) : size(&rows)
{
initEmpty();
create(_rows, _cols, _type);
}
实际的构造函数在
…/core/core.hpp
class CV_EXPORTS Mat
{
public:
//! default constructor
Mat();
//! constructs 2D matrix of the specified size and type
// (_type is CV_8UC1, CV_64FC3, CV_32SC(12) etc.)
Mat(int rows, int cols, int type);
Mat(Size size, int type);
//! constucts 2D matrix and fills it with the specified value _s.
Mat(int rows, int cols, int type, const Scalar& s);
Mat(Size size, int type, const Scalar& s);
//! constructs n-dimensional matrix
Mat(int ndims, const int* sizes, int type);
Mat(int ndims, const int* sizes, int type, const Scalar& s);
//! copy constructor
Mat(const Mat& m);
//! constructor for matrix headers pointing to user-allocated data
Mat(int rows, int cols, int type, void* data, size_t step=AUTO_STEP);
Mat(Size size, int type, void* data, size_t step=AUTO_STEP);
Mat(int ndims, const int* sizes, int type, void* data, const size_t* steps=0);
.....
};
相关文章:
- 具有自定义构造函数 (C++) 的类型的动态数组分配
- 当类成员参数具有相同的名称时,如何定义构造函数?
- C++定义构造函数使对象成为非 POD
- 请描述一下在 c++ 中在此类中定义构造函数的方式?
- 不为 emplace() 定义构造函数的解决方法
- 已定义构造函数的构造函数无法识别
- 在自定义构造函数中的堆上创建指针
- c++ 17 中结构自动定义构造函数的规则是什么?
- Python 错误:在 SWIG 生成的C++模板化代码模块中没有定义构造函数
- unique_ptr看不到派生类的自定义构造函数
- 两种类型的定义构造函数有什么区别?第一个使用":",第二个用大括号(如函数)定义它
- 为什么一个非平凡的成员需要为同一类中的匿名联合定义构造函数
- 为其成员根据模板基类存在的类定义构造函数
- 如何在派生类上具有默认行为,而不是重新定义构造函数
- 在结构中定义构造函数
- 将从基类继承的构造函数与自定义构造函数混合使用
- 如何在模板类外部定义构造函数
- C 需要使用自定义构造函数的帮助
- 可以联合包含具有用户定义构造函数的类的对象
- 具有用户定义构造函数的非聚合类的值初始化