Android 如何使用openCV中的HoughCircles检测感兴趣区域中的圆?
我正在尝试使用圆检测来检测瞳孔。当我将整个Mat图像(mGray)输入HoughCircles函数时,它会检测到许多圆,但当我将Mat图像缩小到面部ROI或眼睛区域ROI时,它不会检测到任何圆 这是我的密码:Android 如何使用openCV中的HoughCircles检测感兴趣区域中的圆?,android,opencv,face-detection,Android,Opencv,Face Detection,我正在尝试使用圆检测来检测瞳孔。当我将整个Mat图像(mGray)输入HoughCircles函数时,它会检测到许多圆,但当我将Mat图像缩小到面部ROI或眼睛区域ROI时,它不会检测到任何圆 这是我的密码: faceROI = mGray.submat(facesArray[i]); Imgproc.GaussianBlur(faceROI,faceROI, new Size(9,9),2,2); Mat circles = new Mat(); Imgpro
faceROI = mGray.submat(facesArray[i]);
Imgproc.GaussianBlur(faceROI,faceROI, new Size(9,9),2,2);
Mat circles = new Mat();
Imgproc.HoughCircles(faceROI,circles,Imgproc.CV_HOUGH_GRADIENT,2,150,200,100,0,0);
for (int x = 0; x<circles.cols(); x++) {
double Circle[] = circles.get(0, x);
Point center = new Point(Math.round(Circle[0]), Math.round(Circle[1]));
int radius = (int)Math.round(Circle[2]);
Core.circle(mRgba, center,2, new Scalar(0,0,255),4);
Core.circle(mRgba,center,radius,new Scalar(0,0,0),4);
}
faceROI=mGray.submat(facesArray[i]);
GaussianBlur(faceROI,faceROI,新尺寸(9,9),2,2);
垫圆=新垫();
Imgproc.HOUGH圆(faceROI,圆,Imgproc.CV_-HOUGH_梯度,215200100,0,0);
对于(int x=0;x我怀疑您在mRgba图像中绘制圆时未检测到偏移中心(它们在ROI坐标中检测到),如果应用偏移没有帮助,请尝试在Hough检测器中降低阈值