2012-11-13 67 views
2

我已發現在如何檢測使用的OpenCV的眨眼C++的一些例子。眨眼檢測的OpenCV的Android

Unhapilly很難找到相同的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檢查一眨眼的任何想法?

我爲週期都在一週尋找在谷歌和這裏這個信息,但我不能找到一個與Android的作品。 =(

歡迎任何幫助!

回答

0

如果在c眨眼檢測功能++,你可以使用一個本地函數(JNI)調用從Android功能比返回一個true或false根據檢測到您的Java代碼。

+0

這正是我我在問怎麼做=) –

1

如果可以檢測眼睛,那麼你可以看看的眼睛,然後消失得很快重現。這看起來像一個閃爍。如果你可以檢測口,那麼你可以確保它留在大致相同的地方也

0

我不知道你的具體實施如何,但這段代碼將hel有意識地認識圈子,在這種情況下是爲了學生。你可以用Viola Jones得到眼睛感興趣的區域,使用Canny檢測器並且在使用Hough Transformation來查找圓圈(開放眼睛)或線(閉合眼睛)後。

一些有用的鏈接:

維奧拉·瓊斯:http://docs.opencv.org/modules/objdetect/doc/cascade_classification.html

Hough變換:http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/hough_lines/hough_lines.html

坎尼探測器:http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/canny_detector/canny_detector.html

另一種方法是使用匹配模板,像http://www.technolabsz.com/2013/05/eye-blink-detection-using-opencv-in.html

0

谷歌已經發布了FaceDetectorApi()爲Android這讓我們眼睛的開雙眼的概率,利用它我們可以檢測到眨眼,這裏是項目實施我已經做了,它工作在實時https://github.com/murali129/Eye-blink-detector