OpenCVã«ã¯é¡æ¤åºç¨ã«å¦ç¿ããã«ã¹ã±ã¼ãåèå¥å¨ã®å¦ç¿çµæãããã®ã§ãããã使ã£ã¦é¡æ¤åºãã¦ã¿ã¾ããã èå¥å¨ã®å¦ç¿çµæã¯ãç°å¢ã»ã¤ã³ã¹ãã¼ã«æ¹æ³ã«ãã£ã¦ä¿åå ´æãè¥å¹²ç°ãªãã¾ãã ⦠åå㯠ç»åããé¡ãæ¤åºãã¾ãããä»åã¯ç®ãæ¤åºãã¦ã¿ã¾ããç®ã®æ¤åºã¯ åºæ¬çã«ã¯é¡ã®æ¤åºã¨åã㧠æ¤åºã«ç¨ããå¦ç¿æ¸ã¿ãã¡ã¤ã«ï¼æ¤åºå¨ã¨å¼ã¶ãããï¼ãç°ãªãã ãã§ããã¨ããã§ãã®å¦ç¿æ¸ã¿ãã¡ã¤ã«ã¯OpenCV-2.3.1shareOpen OpenCVã«ã¯ã«ã¹ã±ã¼ãåé¡å¨ãæ±ãã¯ã©ã¹(cv::CascadeClassifier)ãç¨æããã¦ãã¾ãã ä»åã¯ãããå©ç¨ãã¦ã¢ãã¡é¡æ¤åºããã«ã¡ã©ãä½æãã¾ããã ãªããOpenCVã使ã£ãé¡æ¤åºã®æ¹æ³ã¯ ãOpenCVã§é¡ãæ¤åºãããPythonããã®è¨äºã§è©³ãã解説ãã¦ãã¾ãã æ¤åºããç¯å²ã«å¯¾ãã¦ã¢ã¶ã¤ã¯å¦çãå®æ½ãã. ãªã¼ãºã®ç¬¬15å¼¾ã ä»åã¯ãOpenCVSharpã使ã£ã¦é¡æ¤åºãè¡ãæ¹æ³ãç´¹ä»ãã¾ãã ç»åã®ä¸ã«åå¨ããã人ã®é¡ããæ¤åºããææ³ã§ããã誰ã®é¡ããå¤æããé¡èªèã§ã¯ããã¾ããã OpenCVã«ã¯"Haar-cascade"ã¨å¼ã°ããåé¡å¨ã«ãã£ã¦é¡æ¤åºãè¡ãæ©è½â¦ Python, OpenCVã§ã«ã¹ã±ã¼ãååé¡å¨ã使ã£ãé¡æ¤åºã¨ç³æ¤åºï¼é¡èªèã¨ç³èªèï¼ãè¡ãã以ä¸ã«å
¬å¼ã®ãã¥ã¼ããªã¢ã«ï¼è±èªï¼ããããOpenCV: Face Detection using Haar Cascades ããã§ã¯ãéæ¢ç»: ç»åãã¡ã¤ã«ãèªã¿è¾¼ãã§é¡æ¤åºã¨ç³æ¤åº åç»: ã«ã¡ã©ã使ã£ã¦ãªã¢ã«ã¿ã¤ã ã§é¡æ¤åºã¨ç³æ¤åº ã«ã¤ã㦠⦠ã¨ããããéã«ãã£ã¦ã¿ã¾ããã #include #include void detectObj(const char *cascade_name, IplImage *img, IplImage *gImg, CvMemStorage *storage⦠ä»åã¯ãOpenCVã¨ããã©ã¤ãã©ãªã使ã£ã¦é¡æ¤åºããã¦ãé¡é¨åã ãã®ç»åãçæãã¾ããOpenCVã«ã¯é¡ãç®ãæ¤åºã§ããã«ã¹ã±ã¼ãåé¡å¨ã®å¦ç¿æ¸ã¿ãã¡ã¤ã«ãããã®ã§ãããã使ãã¾ãã Javaããå¼ã³åºãã«ã¯2ã¤ä½æ¥ãå¿
è¦ã§ã 1ããC:\tool\opencv-3.1.0\build\java\opencv-310.jarããã¯ã©ã¹ãã¹ã«éã 2ããC:\tool\opencv-3.1.0\build\java\x64\opencv_java310.dllãã«ãã¹ãéã 2ã¯ããã©ãããã®ã§ãææããããªã該å½ã®DLLãããã¸ã§ã¯ããã©ã«ãç´ä¸ã«ã³ãã¼ãã¾ãããã [OpenCV] é¡æ¤åºãµã³ãã« 2016å¹´3æ12æ¥ 2016å¹´3æ16æ¥ @84kure ãã£ããæµãã¯ãã«ã¹ã±ã¼ãåé¡å¨ã«å¦ç¿æ¸ã¿èå¥å¨ãé£ããã¦æ¤åºå®è¡ã ã¼ã´ã£ï¼ã«ããããéãã£ã¼ãã©ã¼ãã³ã°ã®é¡èªèã®ãã¹ãç¨ã³ã¼ãããã¾ã¨ã¾ã£ã¦ãã¾ãã 赤ã¡ããã®ã°ã¬ã¤è¡¨ç¤ºï¼é¡èªèãã¹ã ããã¦ãOPENCVã¯ãIntelã§éçºãããç»åå¦çé¢é£ã®ã©ã¤ãã©ãªã§ãä»åå®æ½ããé¡æ¤åºãã¯ããã¨ãã¦æ§ã
ãªãã¨ãã§ãã¾ãã OPENCVã¯ãCè¨èªãC++ãJavaãPythonã«å¯¾å¿ãã¦ããããããã¡ããä»åã®Pythonãç¨ããé¡æ¤åºã«ã¯ã´ã£ããã§ãã OpenCVã§ã§ãããã¨ãç¥ããã OpenCVã¯ã©ããªã¨ãã«ä½¿ãããã®ï¼ Pythonãªã©ã®è¨èªã使ã£ã¦æ©æ¢°å¦ç¿ãããããã¨ãã©ã¤ãã©ãªã¯å½¹ã«ç«ã¡ã¾ããç»åãåç»ã®å¦çã«ããã¦OpenCVã¯æ±ç¨æ§ãé«ã人æ°ã®ã©ã¤ãã©ãªã§ãã ã¯ããã«ä»åã¯OpenCVã使ã£ã¦ãã«ã¡ã©ã«æ ã人ã®é¡ããªã¢ã«ã¿ã¤ã ã§èªèããããã°ã©ã ãä½ã£ã¦ã¿ã¾ãããããããªãã¯ã©ã¹ãªã©ãããå ´åã«ã¯ãååã®è¨äºãåç
§ãã¦ãã ãããã«ã¹ã±ã¼ãåé¡æ©ã«ã¤ãã¦ä»åã¯ã«ã¹ã±ã¼ãåé¡æ©ãå©ç¨ãã¦é¡èªè¨¼ãè¡ã ã¯ããã«ä»åã¯OpenCVãç¨ãã¦ç°¡åã«ã§ãããSobelæ³ãã Laplacianæ³ããCannyæ³ãã§ã®ã¨ãã¸æ¤åºæ³ã«ã¤ãã¦ã¾ã¨ãã¾ããç»åã®ä¿åãªã©ã«ã¤ãã¦ã¯ä»¥åã®è¨äºã§è§¦ãã¦ããã®ã§å²æããã¨ãã¸æ¤åºã«å¿
è¦ãªé¢æ°ã«ã¤ãã¦ã®ã¿èª¬æã㦠ãã¦ãããã¨æã£ã¦ãã¾ãã ç®æ¨ã¨ãã¦éç»åã®é¡æ¤åºããããã¨æã£ã¦ãã¾ãã ã¾ããä¿¡é ¼æ§ãé«ããããã«ããç®ããé¡é åä¸ã«åå¨ããå ´åã«æ¤åºã¨ãã ⦠ããããäº éæ¢ç»åãèªã¿è¾¼ãã§é¡ãæ¤åºããæ¤åºç®æã«æ ã表示ãã OpenCVã使ã£ãPythonã§ã®ç»åå¦çã«ã¤ãã¦ãHaar Cascadesã¨ããåé¡å¨ã使ã£ã¦ç»åããã®é¡ã®æ¤åºãæ±ã£ã¦ããã¾ããé¡ã®æ¤åºã¨é¡èªèã¨ã¯éããã¨ã«æ³¨æãã¾ããããããã§ã¯ç»åããã®é¡æ¤åºã¨webã«ã¡ã©ã®é¡æ¤åºãè¡ãã¾ãã WEBã«ã¡ã©ã®æ åããé¡ã¨ç®ãæ¤åºãã¦ç®ã«ã¯ã¢ã¶ã¤ã¯ãããããã¤(Python+OpenCV). Pythonã«ããOpenCVã§é¡æ¤åºã¨æ½åºPythonã®ç»åå¦çããã±ã¼ã¸ãOpenCVããå©ç¨ãã¦ã人ã®ç»åãããé¡ãæ¤åºããæ½åºãã¦ããã¾ããJupyterNotebookã§ãé çªéãã«å®è¡ãããã¨ããããããã¾ãã追å :é¡ç»åã®æ½åº ä»åã¯OpenCVã¨Pythonã¨VisualStudioã§é¡èªèã試ãã¦ã¿ã¾ããã®ã§ãã®æ¹æ³ã«ã¤ãã¦ãç´¹ä»ãã¾ãã ã½ã¼ã¹ã¯ãã¡ãã®ãµã¤ããåèã«ããã¦ããã ãã¾ããã Python, OpenCVã§é¡æ¤åºã¨ç³æ¤åºï¼é¡èªèã ⦠OpenCV 4.0.0ããã¯ãQRã³ã¼ããæ¤åºããæ©è½ãæ¨æºã§å
¥ã£ããªã©ãé²åãç¶ãã¦ãã¾ãã OpenCVã§ã§ãããã¨ä¸è¦§ OpenCVã¯ãã§ãããã¨ãé常ã«å¤ãããã¾ããããã§ã¯ãæ©è½å¥ã«ã©ã®ãããªãã¨ãã§ããã®ãã確èªãã¦ã¿ã¾ãããã [OpenCV] é¡æ¤åºãµã³ãã« [JavaScript] åºæ¬ã¡ã¢: DOMæä½ [C#] INIãã¡ã¤ã«ãèªã¿æ¸ããã [C#] ç»åãã¡ã¤ã«ããExifæ
å ±ãèªã¿åºã . OpenCV(Haar Cascades)ã§æ¤åºã§ããªãå ´åã®å¯¾å¦æ³ é¡æ¤åºã§ããªãå ´åã®å¯¾å¦. OpenCVã«ã¦ç»åãã¡ã¤ã«ããé¡èªè¨¼ãç³æ¤åºãè¡ãå ´åã«ã¯ãã«ã¹ã±ã¼ãååé¡å¨ã使ç¨ãã¾ãã ã«ã¹ã±ã¼ãååé¡å¨ã¯OpenCVã®ã¤ã³ã¹ãã¼ã«ã«åããã¦ã¤ã³ã¹ãã¼ã«ããããããç¹å¥ãªç°å¢ã®è¨å®ã¯å¿
⦠女æ§ã®é¡ãåã£ã¦ããå
¥åç»åpathã«å¯¾ããé¡ã¨ä¸¡ç®ãæ½åºã§ãã¾ããã ãããã§ããã§ããããï¼ ãã®ããã«ãOpenCVã§ã¯ç°¡åã«ç©ä½ãæ¤åºã§ããã®ã§ãã OpenCVã®ã»ãã«ããMacãªã©ã®Appleç³»ã®æ©å¨ã§ãç©ä½æ¤åºãã§ãã¾ãã Javaãã使ãæºå. ããµã³ãã«ã³ã¼ãæããOpenCV é¡æ¤åºããã°ã©ã . æ¤åºæè¡ ã¢ã¤ãã©ããã³ã°ã次ä¸ä»£UIã« https://eyetrack.pas-ta.io. OpenCV çããããã«ã¡ã¯ ãå
æ°ã§ãããç§ã¯å
æ°ã§ãããã¦ãä»æ¥ã¯OpenCVã§é¡æ¤åºãè¡ã£ã¦ã¿ã¾ãã é¡æ¤åºã¨ã¯ãç»é¢ã®ä¸ããé¡ãæ¤åºããã¿ã¹ã¯ã®ãã¨ã§ããæ©éã§ãããã½ã¼ã¹ã³ã¼ããæ¸ãã¦ã¿ã¾ããã #include #include using namespa⦠OpenCV ç»åå¦ç ãOpenCV 4ãç»åä¸ã®é¡ã®ç®ãæ¤åºãã¦ç©å½¢ã§å²ã ç»åã«ãã£ã¦ã¯ä¸æãé¡æ¤åºã§ããªãå ´åãããã¾ããããã®å ´åã¯ã¤ã³ã¹ãã¼ã«ã§ããã«ã¹ã±ã¼ããã¡ã¤ã«ãå¤æ´ããã¨ä¸æãããã¾ãã éçºæºå OpenCV for Unityã§ã«ã¡ã©æ åãæç»ãå
ã«Webã«ã¡ã©æ åãæç»ã§ããããã«ãã¦ãã ããã æ¤åºã«ä½¿ãã«ã¹ã±ã¼ããã¡ã¤ã«ãç¨æãã¾ãã 輪éãæ¤åºããhaarcascade_frontalface_alt.xmlãç¨æãã¾ããã ã«ã¹ã±ã¼ããã¡ã¤ã«ã¨ã¯é¡ãç®ãå£ãªã©ã®ç¹å®ã®ãã®ãç»åããèªèãä½ç½®ãç¹å®ãã㮠⦠ãã¡ãã®è¨äºã§ããªã¢ã«ã¿ã¤ã ã«ã¡ã©ããé¡æ¤åºããã¨ããã¾ã§ã§ããã kawakeee.hatenablog.com ä»åã¯ãé¡æ¤åºããã¿ã¤ãã³ã°ã§ç»åãã¡ã¤ã«(jpg)ãçæãããã é¡æ¤åºæã«æ¡ä»¶åå²ã追å å®è¡ ã½ã¼ã¹ã³ã¼ã åèè¨äº é¡æ¤åºæã«æ¡ä»¶åå²ã追å ååã®face_detect.pyã«ã¦face_lis⦠GitHub Gist: instantly share code, notes, and snippets. ã¾ãé¡ã«å½ããé¨åãæ¤åºããå¾ã該å½ããé¨åã®åº§æ¨ã«å¯¾ãã¦ãç´¹ä»ããæ¹æ³ã§ã¢ã¶ã¤ã¯ãããã¦ãã¾ãã å¦ççµæã®ããã«ããã¡ãã¨é¡ã®ç¯å²ãåè§ãæ¤åºããã¦ãã¾ãã OpenCVããªã¹ã¹ã¡ããçç±. ãªã¢ã«ã¿ã¤ã ã§é¡ã«ã¢ã¶ã¤ã¯ããããPythonã¨ãç»åå¦çã®ã©ã¤ãã©ãªãOpenCVãã§ããªã¢ã«ã¿ã¤ã ã§é¡ã«ã¢ã¶ã¤ã¯ãããã¾ããOpenCVã使ã£ã¦ãWebã«ã¡ã©ããæ åãåå¾ãã¾ããåå¾ããæ åããããªã¢ã«ã¿ã¤ã ã§é¡ã«ã¢ã¶ã¤ã¯ãããã¦ãã