cv::Mat_<KalmanRGBPixel> backgroundModel;
我知道cv :: Mat<>是用于图像和数学,但我想以矩阵形式保存数据.我不打算使用逆,转置,乘法等,它只用于存储数据.我希望它是矩阵形式,因为视频的每个帧的pixel_ij将链接到backgroundModel_ij.
我知道有一个DataType< _Tp> core.hpp中的类需要为我的类型定义,但我不知道该怎么做.
编辑:KalmanRGBPixel只是cv :: KalmanFilter类的包装器.至于现在,它是唯一的成员.
... some functions ... private: cv::KalmanFilter kalman;
谢谢你的帮助.
解决方法
https://docs.opencv.org/master/d0/d3a/classcv_1_1DataType.html
The DataType class is basically used to provide a description of such primitive data types without adding any fields or methods to the corresponding classes (and it is actually impossible to add anything to primitive C/C++ data types). This technique is known in C++ as class traits. It is not DataType itself that is used but its specialized versions […] The main purpose of this class is to convert compilation-time type information to an OpenCV-compatible data type identifier […]
(是的,最后我在这个帖子中回答了问题!)