I'm struggling with zeroing elements of 3D matrix with opencv. I can zero all elements in 2D matrix like following way:
meta = new Mat(Mat::zeros(cluster,3,CV_32S));
I try to use the similar way to initialize elements with 0 in 3D matrix, it fails.
block = new Mat(Mat::zeros(3,dim,CV_32F));
Error message:
1>MatrixOp.obj : error LNK2019: unresolved external symbol "public: static class cv::MatExpr __cdecl cv::Mat::zeros(int,int const *,int)" (?zeros@Mat@cv@@SA?AVMatExpr@2@HPBHH@Z) referenced in function "public: __thiscall MatrixOp::MatrixOp(char *)" (??0MatrixOp@@QAE@PAD@Z)
I got one last way to initialize matrix. Traverse the matrix and set element value 0. But it seems labor-some.
for(int i=0;i<value_num;i++)
for(int j=0;j<frame_no;j++)
for(int k=0;k<cluster;k++)
block->at<float>(i,j,k) = 0;
Can anyone throw me a better ideas? Thanks.