我刚开始学习C++和OpenCV.我正在努力创建自己的功能,但我很困惑为什么copyTo(dst);有效,但是当我使用dst = src.clone();显示的输出是黑色的?
void testFunc(InputArray _src, OutputArray _dst){
Mat src = _src.getMat();
_dst.create(src.size(), src.type());
Mat dst = _dst.getMat();
src.copyTo(dst);
// ^this works but
// dst = src.clone(); doesn't
}
Run Code Online (Sandbox Code Playgroud) 在下面的代码中,如何实例化Side类的对象Rectangle?
class Side{
int l;
public:
Side(int x){
l=x;
}
}
class Rectangle {
Side a, b;
public:
Rectangle(int s1, int s2){
//How to initialize a and b?
}
}
Run Code Online (Sandbox Code Playgroud)