在下面的代码中,我想使用该dilate
函数,但我不知道如何将一个Mat
类转换为InputArray
and OutputArray
。你能帮助我吗?
使用这个原型函数:
void dilate(InputArray src, OutputArray dst, InputArray kernel, Point anchor=Point(-1,-1), int iterations=1, int borderType=BORDER_CONSTANT, const Scalar& borderValue=morphologyDefaultBorderValue() )
这是我的代码:
#include "opencv2/opencv.hpp"
using namespace cv;
int main(int, char**)
{
Mat edges;
VideoCapture cap(0); // open the default camera
if(!cap.isOpened()) // check if we succeeded
return -1;
for(;;)
{
Mat frame;
cap >> frame; // get a new frame from camera
cvtColor(frame, edges, CV_BGR2GRAY);
GaussianBlur(edges, edges, Size(7,7), 1.5, 1.5);
//dilate(edges,edges,NULL);
Canny(edges, edges, 0, 30, 3);
imshow("edges", frame);
if(waitKey(30) >= 0) break;
}
// the camera will be deinitialized automatically in VideoCapture destructor
return 0;
}