我很难编译这段代码:
UMat dx, dy;
Sobel(GREY_IMAGE, dx, GREY_IMAGE.depth(), 1, 0, 3);
Sobel(GREY_IMAGE, dy, GREY_IMAGE.depth(), 0, 1, 3);
resize(dx, dx, Size(dx.rows, dx.rows), 0, 0, CV_INTER_AREA);
resize(dy, dy, Size(dx.rows, dx.rows), 0, 0, CV_INTER_AREA);
UMat mag(dx.size(), dx.type());
magnitude(dx, dy, mag);
每当我尝试它时,都会得到响应:
{msg =“ OpenCV(4.0.0-dev)E:\ opencv-master \ modules \ core \ src \ mathfuncs.cpp:151:错误:(-215:断言失败)src1.size()== src2.size()&&类型== src2.type()&&(深度== CV_32F ||深度== CV_64F)... ...
我不知道上面的代码有什么问题。尺寸还可以,所有三个矩阵都是平方的。我该怎么办?