Floodfill出现错误,我能够检测到卡尼边缘,并且结果显示在相机中。然后,我尝试从中创建一个蒙版,当我将蒙版作为参数进行泛洪时,它显示了以下错误。请某人帮助我已经看了互联网好几个星期了,但是找不到解决方案。
我已经在c ++ visual studio中获得了相同的结果,但是我想使其在适用于android应用程序的java中工作。
public Mat onCameraFrame(CvCameraViewFrame inputFrame) {
mRgba = inputFrame.rgba();
Mat imgGray = new Mat();
Imgproc.cvtColor(mRgba, imgGray, Imgproc.COLOR_RGBA2GRAY);
Imgproc.Canny(imgGray, imgGray, 100, 150,3,false);
// if I return mRgba without floodfill, its detecting edges and shows the output
Mat mask = new
Mat(imgGray.width()+2,imgGray.height()+2,CvType.CV_8UC1,Scalar.all(0));
// x and y are the coordinates that I get from touchEvent
Imgproc.floodFill(mRgba,mask,new Point(x,y),new Scalar(120,50,85),new Rect(), new Scalar(2,2,2),new Scalar(2, 2, 2));
return mRgba;
}
我希望该应用更改所选区域的颜色,但该应用会崩溃并给出以下错误:Caused by: CvException: error: (-215:Assertion failed) mask.rows == size.height+2 && mask.cols == size.width+2 in function 'int cv::floodFill(...)
“