【发布时间】:2012-11-01 13:04:36
【问题描述】:
我在 C++ 中找到了一些关于如何使用 OpenCV 检测眨眼的示例。
不幸的是,很难找到适用于 Android 的相同功能。
我找到了这个:
case Sample2NativeCamera.VIEW_MODE_HOUGH_CIRCLES:
capture.retrieve(mRgba, Highgui.CV_CAP_ANDROID_COLOR_FRAME_RGBA);
Imgproc.cvtColor(mRgba, mGray, Imgproc.COLOR_RGBA2GRAY, 4);
// doing a gaussian blur prevents getting a lot of small false circles
Imgproc.GaussianBlur(mGray, mGray, new Size(5, 5), 2, 2);
// the lower this figure the more spurious circles you get
// 50 looks good in CANNY, but 100 is better when converting that into Hough circles
iCannyUpperThreshold = 100;
Imgproc.HoughCircles(mGray, mIntermediateMat, Imgproc.CV_HOUGH_GRADIENT, 2.0, mGray.rows() / 8,
iCannyUpperThreshold, iAccumulator, iMinRadius, iMaxRadius);
if (mIntermediateMat.cols() > 0)
for (int x = 0; x < Math.min(mIntermediateMat.cols(), 10); x++)
{
double vCircle[] = mIntermediateMat.get(0,x);
if (vCircle == null)
break;
pt = new Point(Math.round(vCircle[0]), Math.round(vCircle[1]));
radius = (int)Math.round(vCircle[2]);
// draw the found circle
Core.circle(mRgba, pt, radius, colorRed, iLineThickness);
// draw a cross on the centre of the circle
DrawCross (mRgba, pt);
}
if (bDisplayTitle)
ShowTitle ("Hough Circles", 1);
break;
但我不知道如何在我的 OpenCV 示例代码中使用它。我有所有 OpenCV 示例代码。我正在使用 OpenCV - 人脸检测。
我刚刚将级联从正面更改为眼睛。 所以,它起作用了……它可以检测眼睛。
但是,我需要检测的不仅仅是眼睛的位置。 我需要检测用户何时眨眼。 我看到了上面的代码,但我不知道如何在我的 OpenCV 人脸检测代码中使用它,因为它使用级联来检测眼睛。上面的方法没有使用级联。那么,我该如何使用呢?
关于如何使用 OpenCV 检查眨眼的任何想法?
我花了将近一周的时间在 Google 和此处寻找此信息,但我找不到适用于 Android 的信息。 =(
欢迎任何帮助!
【问题讨论】: