我发布了我的代码的一小部分,因为我一直得到一个奇怪的错误,我似乎无法摆脱。在这一行中可以找到问题:Imgproc.GaussianBlur(mGray,mGray,新尺寸(5,5),2.2,2);
public Mat onCameraFrame(Mat inputFrame) {
mGray = new Mat();
Imgproc.cvtColor(mRgba, mGray, Imgproc.COLOR_RGBA2GRAY);
// doing a gaussian blur prevents getting a lot of false hits
Imgproc.GaussianBlur(mGray, mGray, new Size (5,5), 2.2, 2);
// Values 3 and 4are the LowerThreshold and UpperThreshold.
Imgproc.Canny(inputFrame, mIntermediateMat, 80, 100);
Imgproc.cvtColor(mIntermediateMat,mRgba, Imgproc.COLOR_GRAY2BGRA, 4);
return mIntermediateMat;
}我从Eclipse获得的错误是:
The method GaussianBlur(Mat,Mat,Size,double,double) in
the type imgproc is not applicable for the arguments (Mat,Mat,CameraSize,int,int)我使用的是经过编辑的tutorial3摄像头控制版本(OpenCV用于AndroidVersion2.4.4),其中输出显示为Canny的边缘检测。我需要GaussianBlur来消除一些较小的细节。有谁知道这行代码到底出了什么问题吗?
发布于 2013-03-06 17:25:06
我从Alexander Smorkalov那里得到了这个解决方案,它成功了。将Imgproc.GaussianBlur(mGray,mGray,新大小(5,5),2.2,2)改为Imgproc.GaussianBlur(mGray,mGray,新org.opencv.core.Size (5,5),2.2,2);
发布于 2013-05-04 11:58:38
这个代码很好用。只需根据需要重新排序参数即可。
Imgproc.GaussianBlur(mGray, mGray, new Size(15,15),50);大小意味着您将使用它作为内核大小。另外,内核大小必须是奇数! 50显示了X方向的内核标准差。
公式:sigma = 0.3 * ((kSize-1)*0.5 - 1) + 0.8
这里西格玛传递50,所以sigmaX = sigmaY = 50
https://stackoverflow.com/questions/15208184
复制相似问题