As far as I know the ones method create only 2D matrix, if you want to initialize your matrix with a specified values you have to do it with the constructor
int sz[]={3,3,3};
T=Mat(3,sz,CV_32F, Scalar::all(1));
Вопрос
I have a strange error using opencv under visual studio 11. When I do this:
int sz[]={3,3,3};
T=Mat(3,sz,CV_32F);
or this (2D matrix initialized to ones):
T=Mat::ones(3,3,CV_32F);
everything works fine
but this (3D matrix initialized to ones):
int sz[]={3,3,3};
T=Mat::ones(3,sz,CV_32F);
gives me a linking error:
Error 6 error LNK2019: unresolved external symbol "public: static class cv::MatExpr __cdecl cv::Mat::ones(int,int const *,int)"
Why is this? Do I need to link something extra when I initialize n dimensional matrices with ones?
Решение
As far as I know the ones method create only 2D matrix, if you want to initialize your matrix with a specified values you have to do it with the constructor
int sz[]={3,3,3};
T=Mat(3,sz,CV_32F, Scalar::all(1));