{"id":108492,"date":"2026-09-21T22:24:39","date_gmt":"2026-09-21T14:24:39","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/108492.html"},"modified":"2026-09-21T22:24:39","modified_gmt":"2026-09-21T14:24:39","slug":"opencv-%e7%96%b2%e5%8a%b3%e6%a3%80%e6%b5%8b2%e9%97%ad%e7%9c%bc%e6%8a%a5%e8%ad%a6%e7%9a%84%e4%b8%bb%e5%be%aa%e7%8e%af","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/108492.html","title":{"rendered":"Opencv-\u75b2\u52b3\u68c0\u6d4b2\u95ed\u773c\u62a5\u8b66\u7684\u4e3b\u5faa\u73af"},"content":{"rendered":"<p style=\"text-align:center\">\n<p><span style=\"color:#1f3864\">\u4e00\u3001\u627f\u4e0a\u542f\u4e0b<\/span><\/p>\n<p>\u4e0a\u7bc7\u7b97\u597d\u4e86 EAR\u3001\u88c5\u597d\u4e86\u4e24\u4e2a\u6a21\u578b&#xff0c;\u672c\u7bc7\u8d34\u51fa\u75b2\u52b3\u68c0\u6d4b.py \u5269\u4e0b\u7684\u5b8c\u6574\u4ee3\u7801\u2014\u2014\u4e3b\u5faa\u73af&#xff0c;\u4e00\u5b57\u672a\u5220&#xff0c;\u5e76\u91cd\u70b9\u8bb2\u6e05\u695a&#034;\u4e3a\u4ec0\u4e48\u4e0d\u4f1a\u628a\u6b63\u5e38\u7728\u773c\u8bef\u62a5\u6210\u75b2\u52b3&#034;\u3002<\/p>\n<p><span style=\"color:#1f3864\">\u4e8c\u3001\u5b8c\u6574\u4ee3\u7801&#xff08;\u4e0b&#xff09;&#xff1a;\u4e3b\u5faa\u73af<\/span><\/p>\n<h3>\u5757 1\ufe0f\u20e3 \u8bfb\u5e27<\/h3>\n<p>python<\/p>\n<p>while True:<br \/>\n    ret, frame &#061; cap.read()<br \/>\n    if not ret:<br \/>\n        break<\/p>\n<ul>\n<li>while True&#xff1a;\u65e0\u9650\u5faa\u73af&#xff0c;\u76f4\u5230 break<\/li>\n<li>cap.read()&#xff1a;\u8bfb\u4e00\u5e27&#xff0c;\u8fd4\u56de (ret, frame)<\/li>\n<li>ret \u4e3a False&#xff1a;\u6444\u50cf\u5934\u65ad\u5f00\/\u8bfb\u53d6\u5931\u8d25 \u2192 break \u9000\u51fa<\/li>\n<li>frame&#xff1a;\u5f53\u524d\u5e27\u56fe\u50cf&#xff08;BGR&#xff09;<\/li>\n<\/ul>\n<p>\u548c\u5e74\u9f84\u68c0\u6d4b\u7bc7\u5199\u6cd5\u4e00\u81f4\u3002\u533a\u522b&#xff1a;\u8fd9\u91cc frame \u540e\u9762\u8fd8\u8981\u7ecf\u8fc7\u7070\u5ea6\u8f6c\u6362\u3001\u68c0\u6d4b\u3001\u753b\u8f6e\u5ed3\u3001\u5199\u4e2d\u6587&#xff0c;\u94fe\u8def\u66f4\u957f\u3002<\/p>\n<p>\u8e29\u5751\u70b9&#xff1a;\u4e0d\u68c0\u67e5 ret \u5c31\u7528 frame&#xff0c;\u6444\u50cf\u5934\u65ad\u4e86\u4f1a\u62ff None \u53bb\u505a\u540e\u7eed\u64cd\u4f5c&#xff0c;\u62a5\u9519\u4f4d\u7f6e\u5f88\u9760\u540e&#xff0c;\u96be\u6392\u67e5\u3002<\/p>\n<hr \/>\n<h3>\u5757 2\ufe0f\u20e3 \u7070\u5ea6 &#043; \u4eba\u8138\u68c0\u6d4b<\/h3>\n<p>python<\/p>\n<p>    gray &#061; cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)<br \/>\n    faces &#061; detector(gray, 0)<\/p>\n<h4>2.1 \u4e3a\u4ec0\u4e48\u8981\u8f6c\u7070\u5ea6<\/h4>\n<table>\n<tr>\u9879\u76ee\u5f69\u8272\u7070\u5ea6<\/tr>\n<tbody>\n<tr>\n<td>\u901a\u9053\u6570<\/td>\n<td>3<\/td>\n<td>1<\/td>\n<\/tr>\n<tr>\n<td>\u8ba1\u7b97\u91cf<\/td>\n<td>\u5927<\/td>\n<td>\u5c0f<\/td>\n<\/tr>\n<tr>\n<td>HOG \u68c0\u6d4b\u5668<\/td>\n<td>\u4e0d\u7528\u989c\u8272\u4fe1\u606f<\/td>\n<td>\u53ea\u5403\u7070\u5ea6<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<ul>\n<li>HOG \u7279\u5f81\u53ea\u770b\u68af\u5ea6\u65b9\u5411&#xff0c;\u4e0d\u9700\u8981\u989c\u8272<\/li>\n<li>\u8f6c\u7070\u5ea6\u7701 2\/3 \u6570\u636e\u91cf&#xff0c;\u901f\u5ea6\u5feb\u4e00\u622a<\/li>\n<\/ul>\n<h4>2.2 detector(gray, 0) \u7684\u53c2\u6570<\/h4>\n<ul>\n<li>\n<p>\u7b2c 1 \u4e2a\u53c2\u6570&#xff1a;\u56fe\u50cf&#xff08;\u7070\u5ea6&#xff09;<\/p>\n<\/li>\n<li>\n<p>\u7b2c 2 \u4e2a\u53c2\u6570&#xff1a;\u4e0a\u91c7\u6837\u6b21\u6570<\/p>\n<ul>\n<li>\n<p>0&#xff1a;\u4e0d\u653e\u5927&#xff0c;\u901f\u5ea6\u5feb&#xff0c;\u5c0f\u8138\u53ef\u80fd\u6f0f\u68c0<\/p>\n<\/li>\n<li>\n<p>1&#xff1a;\u653e\u5927 1 \u500d&#xff0c;\u5c0f\u8138\u68c0\u51fa\u7387\u9ad8&#xff0c;\u4f46\u6162 4 \u500d<\/p>\n<\/li>\n<li>\n<p>\u6444\u50cf\u5934\u573a\u666f\u4e00\u822c\u7528 0 \u591f\u7528<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>2.3 \u4e00\u4e2a\u91cd\u8981\u7684\u7ec6\u8282&#xff1a;\u68c0\u6d4b\u5728\u7070\u5ea6\u4e0a&#xff0c;\u6807\u70b9\u7528\u539f\u56fe<\/h4>\n<p>python<\/p>\n<p>    for face in faces:<br \/>\n        shape &#061; predictor(frame, face)   # \u2190 \u8fd9\u91cc\u4f20\u7684\u662f frame&#xff0c;\u4e0d\u662f gray<\/p>\n<ul>\n<li>\n<p>\u4eba\u8138\u68c0\u6d4b\u5728 gray \u4e0a\u505a&#xff08;\u5feb&#xff09;<\/p>\n<\/li>\n<li>\n<p>68 \u5173\u952e\u70b9\u5728 frame \u4e0a\u505a&#xff08;\u66f4\u51c6&#xff09;<\/p>\n<\/li>\n<li>\n<p>\u4e3a\u4ec0\u4e48\u5173\u952e\u70b9\u7528\u539f\u56fe&#xff1a;predictor \u662f\u8bad\u7ec3\u5728\u5f69\u8272\u56fe\u4e0a\u7684&#xff0c;\u7ed9\u5b83\u5f69\u8272\u56fe\u5b9a\u4f4d\u66f4\u7cbe\u7ec6<\/p>\n<\/li>\n<li>\n<p>\u4e24\u8005\u5750\u6807\u4e00\u81f4&#xff08;\u7070\u5ea6\u56fe\u548c\u5f69\u8272\u56fe\u5c3a\u5bf8\u76f8\u540c&#xff09;&#xff0c;\u6240\u4ee5 face \u77e9\u5f62\u6846\u53ef\u4ee5\u76f4\u63a5\u7528\u5728 frame \u4e0a<\/p>\n<\/li>\n<\/ul>\n<p>\u8e29\u5751\u70b9&#xff1a;\u628a predictor(gray, face) \u5199\u9519\u4e0d\u4f1a\u62a5\u9519&#xff0c;\u4f46\u5173\u952e\u70b9\u7cbe\u5ea6\u53ef\u80fd\u4e0b\u964d\u3002<\/p>\n<hr \/>\n<h3>\u5757 3\ufe0f\u20e3 \u9632\u8bef\u62a5\u7b2c\u4e00\u6b65&#xff1a;\u65e0\u4eba\u8138\u5c31\u6e05\u96f6<\/h3>\n<p>python<\/p>\n<p>    if len(faces) &#061;&#061; 0:<br \/>\n        counter &#061; 0<\/p>\n<h4>3.1 \u4f5c\u7528<\/h4>\n<ul>\n<li>\u753b\u9762\u91cc\u6ca1\u6709\u4eba\u8138 \u2192 \u4e4b\u524d\u7684&#034;\u8fde\u7eed\u95ed\u773c&#034;\u8bb0\u5f55\u4f5c\u5e9f<\/li>\n<li>\u4eba\u90fd\u4e0d\u5728\u4e86&#xff0c;counter \u8fd8\u7559\u7740\u65e7\u503c\u4e0d\u5408\u7406<\/li>\n<\/ul>\n<h4>3.2 \u4e3a\u4ec0\u4e48\u653e\u5728 for \u5faa\u73af\u5916\u9762<\/h4>\n<ul>\n<li>len(faces) &#061;&#061; 0 \u662f&#034;\u6574\u5e27\u7ea7\u522b&#034;\u7684\u5224\u65ad<\/li>\n<li>\u5982\u679c\u653e\u8fdb for face in faces \u91cc&#xff0c;faces \u4e3a\u7a7a\u65f6\u5faa\u73af\u6839\u672c\u4e0d\u6267\u884c&#xff0c;\u8fd9\u884c\u4e5f\u767d\u5199<\/li>\n<\/ul>\n<h4>3.3 \u548c\u540e\u9762 counter \u7684\u5173\u7cfb<\/h4>\n<p>counter \u662f\u6a21\u5757\u7ea7\u5168\u5c40\u53d8\u91cf&#xff08;\u4e0a\u7bc7\u5b9a\u4e49\u7684&#xff09;&#xff0c;\u8fd9\u91cc\u4e3b\u5faa\u73af\u91cc\u76f4\u63a5\u8bfb\u5199\u3002<\/p>\n<ul>\n<li>\n<p>\u56e0\u4e3a\u5728\u6a21\u5757\u9876\u5c42&#xff08;\u4e0d\u5728\u51fd\u6570\u91cc&#xff09;&#xff0c;\u6240\u4ee5\u4e0d\u9700\u8981 global \u58f0\u660e<\/p>\n<\/li>\n<li>\n<p>\u5982\u679c\u4ee5\u540e\u628a\u5b83\u5305\u8fdb main() \u51fd\u6570&#xff0c;\u5c31\u8981\u5199 global counter<\/p>\n<\/li>\n<\/ul>\n<p>\u8e29\u5751\u70b9&#xff1a;counter \u5b9a\u4e49\u5728\u6a21\u5757\u9876\u5c42&#xff0c;\u4e3b\u5faa\u73af\u4e5f\u5728\u9876\u5c42&#xff0c;\u6240\u4ee5\u80fd\u76f4\u63a5\u6539\u3002\u4e00\u65e6\u5305\u8fdb\u51fd\u6570&#xff0c;\u5fd8\u8bb0 global \u5c31\u4f1a\u5728 counter &#043;&#061; 1 \u65f6\u62a5 UnboundLocalError\u3002<\/p>\n<hr \/>\n<h3>\u5757 4\ufe0f\u20e3 \u6807\u5173\u952e\u70b9 &#043; \u63d0\u53d6\u53cc\u773c &#043; \u7b97 EAR<\/h3>\n<p>python<\/p>\n<p>    for face in faces:<br \/>\n        shape &#061; predictor(frame, face)<br \/>\n        shape &#061; np.array([[p.x, p.y] for p in shape.parts()])<\/p>\n<p>        rightEye &#061; shape[36:42]<br \/>\n        leftEye &#061; shape[42:48]<\/p>\n<p>        rightEAR &#061; eye_aspect_ratio(rightEye)<br \/>\n        leftEAR &#061; eye_aspect_ratio(leftEye)<br \/>\n        ear &#061; (rightEAR &#043; leftEAR) \/ 2.0<\/p>\n<h4>4.1 predictor(frame, face)<\/h4>\n<ul>\n<li>\n<p>\u8f93\u5165&#xff1a;\u56fe\u50cf &#043; \u4eba\u8138\u77e9\u5f62\u6846<\/p>\n<\/li>\n<li>\n<p>\u8f93\u51fa&#xff1a;full_object_detection \u5bf9\u8c61&#xff0c;\u542b 68 \u4e2a\u70b9<\/p>\n<\/li>\n<li>\n<p>shape.parts()&#xff1a;\u8fd4\u56de 68 \u4e2a\u70b9\u5bf9\u8c61\u7684\u8fed\u4ee3\u5668<\/p>\n<\/li>\n<\/ul>\n<h4>4.2 \u5217\u8868\u63a8\u5bfc\u5f0f\u8f6c\u5750\u6807\u6570\u7ec4<\/h4>\n<p>python<\/p>\n<p>shape &#061; np.array([[p.x, p.y] for p in shape.parts()])<\/p>\n<ul>\n<li>\n<p>\u6bcf\u4e2a p \u6709 .x\u3001.y \u5c5e\u6027<\/p>\n<\/li>\n<li>\n<p>\u5217\u8868\u63a8\u5bfc\u5f0f\u751f\u6210 [[x0,y0], [x1,y1], &#8230;]<\/p>\n<\/li>\n<li>\n<p>np.array(&#8230;) \u8f6c\u6210\u5f62\u72b6 (68, 2) \u7684\u6570\u7ec4<\/p>\n<\/li>\n<li>\n<p>\u5fc5\u987b\u8f6c\u6570\u7ec4&#xff0c;\u540e\u9762 eye[1] &#8211; eye[5] \u624d\u80fd\u505a\u5411\u91cf\u51cf\u6cd5<\/p>\n<\/li>\n<\/ul>\n<p>\u8e29\u5751\u70b9&#xff1a;shape \u53d8\u91cf\u88ab\u590d\u7528\u4e86\u2014\u2014\u5148\u662f dlib \u5bf9\u8c61&#xff0c;\u540e\u662f numpy \u6570\u7ec4\u3002\u540c\u540d\u8986\u76d6&#xff0c;\u540e\u9762\u53ea\u80fd\u62ff\u6570\u7ec4\u7528&#xff0c;\u522b\u60f3\u518d\u8bbf\u95ee dlib \u5bf9\u8c61\u7684\u5c5e\u6027\u3002<\/p>\n<h4>4.3 \u5207\u7247\u53d6\u53cc\u773c<\/h4>\n<table>\n<tr>\u5207\u7247\u773c\u775bdlib \u70b9\u7f16\u53f7<\/tr>\n<tbody>\n<tr>\n<td>shape[36:42]<\/td>\n<td>\u53f3\u773c&#xff08;\u753b\u9762\u5de6\u4fa7&#xff09;<\/td>\n<td>36~41&#xff0c;6 \u4e2a\u70b9<\/td>\n<\/tr>\n<tr>\n<td>shape[42:48]<\/td>\n<td>\u5de6\u773c&#xff08;\u753b\u9762\u53f3\u4fa7&#xff09;<\/td>\n<td>42~47&#xff0c;6 \u4e2a\u70b9<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<ul>\n<li>Python \u5207\u7247\u5de6\u95ed\u53f3\u5f00&#xff0c;36:42 \u53d6 36,37,38,39,40,41<\/li>\n<li>\u547d\u540d\u662f&#034;\u4eba\u8138\u672c\u4eba\u7684\u5de6\u53f3\u773c&#034;&#xff0c;\u548c\u753b\u9762\u5de6\u53f3\u76f8\u53cd\u2014\u2014\u5bf9\u7740\u6444\u50cf\u5934\u65f6&#xff0c;\u4f60\u7684\u53f3\u773c\u5728\u753b\u9762\u5de6\u8fb9<\/li>\n<li>\u4ee3\u7801\u91cc rightEye &#061; \u70b9 36~41 &#061; \u753b\u9762\u5de6\u4fa7\u90a3\u53ea\u773c<\/li>\n<\/ul>\n<h4>4.4 \u53cc\u773c EAR \u53d6\u5e73\u5747<\/h4>\n<p>python<\/p>\n<p>ear &#061; (rightEAR &#043; leftEAR) \/ 2.0<\/p>\n<ul>\n<li>\n<p>\u5355\u773c\u53ef\u80fd\u56e0\u4e3a\u4fa7\u5934\u3001\u906e\u6321\u800c\u4e0d\u51c6<\/p>\n<\/li>\n<li>\n<p>\u53cc\u773c\u5e73\u5747\u66f4\u7a33\u5b9a&#xff0c;\u51cf\u5c11\u8bef\u5224<\/p>\n<\/li>\n<li>\n<p>\u8fd9\u662f\u5e38\u89c1\u505a\u6cd5&#xff0c;\u4e0d\u662f\u5fc5\u987b&#xff0c;\u4f46\u63a8\u8350<\/p>\n<\/li>\n<\/ul>\n<p>\u8e29\u5751\u70b9&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u5982\u679c eye_aspect_ratio \u91cc\u6ca1\u6709 .astype(np.float64)&#xff0c;eye[1] &#8211; eye[5] \u5728 int \u6570\u7ec4\u4e0a\u4e5f\u80fd\u7b97&#xff0c;\u4f46\u6781\u7aef\u60c5\u51b5\u4e0b\u8981\u5c0f\u5fc3\u7cbe\u5ea6<\/p>\n<\/li>\n<li>\n<p>np.linalg.norm \u8981\u6c42\u8f93\u5165\u662f\u6570\u503c\u6570\u7ec4&#xff0c;list \u4e0d\u884c<\/p>\n<\/li>\n<\/ul>\n<hr \/>\n<h3>\u5757 5\ufe0f\u20e3 \u9632\u8bef\u62a5\u7b2c\u4e8c\u6b65&#xff1a;\u8fde\u7eed\u5e27\u8ba1\u6570&#xff08;\u6838\u5fc3&#xff09;<\/h3>\n<p>python<\/p>\n<p>        if ear &lt; 0.3:<br \/>\n            counter &#043;&#061; 1<br \/>\n            if counter &gt;&#061; 50:<br \/>\n                frame &#061; cv2AddChineseText(frame, &#034;!!!\u5371\u9669!!!&#034;, (250, 250))<br \/>\n        else:<br \/>\n            counter &#061; 0<\/p>\n<h4>5.1 \u4e3a\u4ec0\u4e48\u4e0d\u80fd&#034;\u4e00\u95ed\u773c\u5c31\u62a5\u8b66&#034;<\/h4>\n<table>\n<tr>\u573a\u666f\u6301\u7eed\u65f6\u957f\u4e00\u95ed\u773c\u5c31\u62a5\u8b66\u7684\u540e\u679c<\/tr>\n<tbody>\n<tr>\n<td>\u6b63\u5e38\u7728\u773c<\/td>\n<td>1~2 \u5e27&#xff08;\u7ea6 0.03~0.06 \u79d2&#xff09;<\/td>\n<td>\u75af\u72c2\u8bef\u62a5<\/td>\n<\/tr>\n<tr>\n<td>\u771f\u56f0\u95ed\u773c<\/td>\n<td>\u6570\u5341\u5e27\u4ee5\u4e0a<\/td>\n<td>\u8be5\u62a5<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5982\u679c\u53ea\u770b\u5355\u5e27 EAR&#xff0c;\u7728\u773c\u77ac\u95f4 EAR \u5c31\u6389\u4e0b\u53bb\u4e86&#xff0c;\u4f1a\u62a5\u8b66 \u2192 \u72fc\u6765\u4e86\u3002<\/p>\n<h4>5.2 counter \u7684\u5de5\u4f5c\u673a\u5236<\/h4>\n<p>text<\/p>\n<p>\u8fde\u7eed\u95ed\u773c\u5e27\u6570&#xff1a;<br \/>\n  \u7741\u773c       \u2192 counter &#061; 0<br \/>\n  \u95ed\u773c\u7b2c 1 \u5e27 \u2192 counter &#061; 1<br \/>\n  \u95ed\u773c\u7b2c 2 \u5e27 \u2192 counter &#061; 2<br \/>\n  &#8230;<br \/>\n  \u95ed\u773c\u7b2c 50 \u5e27 \u2192 counter &#061; 50 \u2265 50 \u2192 \u62a5\u8b66<br \/>\n  \u7741\u773c        \u2192 counter &#061; 0&#xff08;\u6e05\u96f6&#xff0c;\u91cd\u65b0\u8ba1\u6570&#xff09;<\/p>\n<ul>\n<li>\n<p>\u95ed\u773c\u7d2f\u52a0&#xff1a;counter &#043;&#061; 1<\/p>\n<\/li>\n<li>\n<p>\u7741\u773c\u6e05\u96f6&#xff1a;else: counter &#061; 0<\/p>\n<\/li>\n<li>\n<p>\u5230\u9608\u503c\u62a5\u8b66&#xff1a;counter &gt;&#061; 50<\/p>\n<\/li>\n<\/ul>\n<h4>5.3 \u4e3a\u4ec0\u4e48\u662f 50 \u5e27<\/h4>\n<ul>\n<li>\n<p>\u6444\u50cf\u5934\u4e00\u822c 30 FPS<\/p>\n<\/li>\n<li>\n<p>50 \u5e27 \u00f7 30 FPS \u2248 1.6 \u79d2<\/p>\n<\/li>\n<li>\n<p>\u6b63\u5e38\u7728\u773c &lt; 0.3 \u79d2&#xff0c;\u4e0d\u4f1a\u8fbe\u5230<\/p>\n<\/li>\n<li>\n<p>\u771f\u56f0\u95ed\u773c\u5f80\u5f80 &gt; 2 \u79d2&#xff0c;\u4f1a\u8fbe\u5230<\/p>\n<\/li>\n<li>\n<p>50 \u662f\u7ecf\u9a8c\u503c&#xff0c;\u53ef\u6309\u9700\u8c03&#xff08;20~60 \u90fd\u5408\u7406&#xff09;<\/p>\n<\/li>\n<\/ul>\n<h4>5.4 \u62a5\u8b66\u65b9\u5f0f<\/h4>\n<p>python<\/p>\n<p>frame &#061; cv2AddChineseText(frame, &#034;!!!\u5371\u9669!!!&#034;, (250, 250))<\/p>\n<ul>\n<li>\n<p>\u4f4d\u7f6e (250, 250)&#xff1a;\u753b\u9762\u4e2d\u592e\u504f\u4e0a<\/p>\n<\/li>\n<li>\n<p>\u6ca1\u6709 max(0, &#8230;) \u4fdd\u62a4&#xff0c;\u56e0\u4e3a 250 \u662f\u56fa\u5b9a\u503c&#xff0c;\u4e0d\u4f1a\u662f\u8d1f\u6570<\/p>\n<\/li>\n<li>\n<p>\u5b57\u8272\u7528\u9ed8\u8ba4\u7eff\u8272 (0,255,0)\u2014\u2014\u6559\u7a0b\u6b63\u6587\u8bf4&#034;\u7ea2\u8272&#034;&#xff0c;\u4f46\u4ee3\u7801\u9ed8\u8ba4\u662f\u7eff\u8272&#xff0c;\u8fd9\u662f\u539f\u6587\u4e0d\u4e00\u81f4\u7684\u5730\u65b9&#xff0c;\u60f3\u771f\u7ea2\u8272\u8981\u4f20 textColor&#061;(255, 0, 0)<\/p>\n<\/li>\n<\/ul>\n<p>\u8e29\u5751\u70b9&#xff1a;<\/p>\n<ul>\n<li>\n<p>counter \u662f\u5168\u5c40\u53d8\u91cf&#xff0c;\u6a21\u5757\u9876\u5c42\u80fd\u76f4\u63a5\u6539&#xff1b;\u5305\u8fdb\u51fd\u6570\u8981 global<\/p>\n<\/li>\n<li>\n<p>\u9608\u503c 0.3 \u548c 50 \u90fd\u662f\u9b54\u6cd5\u6570\u5b57&#xff0c;\u53ef\u4ee5\u63d0\u5230\u6587\u4ef6\u9876\u90e8\u5f53\u5e38\u91cf<\/p>\n<\/li>\n<li>\n<p>\u60f3\u8ba9\u5b83\u771f\u6b63&#034;\u7ea2\u8272&#034;&#xff0c;\u5f97\u5199\u6210 cv2AddChineseText(frame, &#034;!!!\u5371\u9669!!!&#034;, (250, 250), textColor&#061;(255, 0, 0))<\/p>\n<\/li>\n<\/ul>\n<hr \/>\n<h3>\u5757 6\ufe0f\u20e3 \u753b\u773c\u775b\u8f6e\u5ed3 &#043; \u663e\u793a EAR<\/h3>\n<p>python<\/p>\n<p>        drawEye(frame, rightEye)<br \/>\n        drawEye(frame, leftEye)<\/p>\n<p>        info &#061; &#034;EAR:{:.2f}&#034;.format(ear)<br \/>\n        frame &#061; cv2AddChineseText(frame, info, (0, 30))<\/p>\n<h4>6.1 \u753b\u7eff\u8272\u8f6e\u5ed3<\/h4>\n<ul>\n<li>\n<p>drawEye \u662f\u4e0a\u7bc7\u5b9a\u4e49\u7684\u51fd\u6570&#xff1a;\u51f8\u5305 &#043; drawContours \u7eff\u8272\u7ebf<\/p>\n<\/li>\n<li>\n<p>\u8c03\u7528\u4e24\u6b21&#xff0c;\u5de6\u53f3\u773c\u5404\u753b\u4e00\u6b21<\/p>\n<\/li>\n<li>\n<p>\u89c6\u89c9\u53cd\u9988&#xff1a;\u95ed\u773c\u65f6\u8f6e\u5ed3\u4f1a\u660e\u663e\u53d8\u6241<\/p>\n<\/li>\n<\/ul>\n<h4>6.2 \u683c\u5f0f\u5316 EAR \u5b57\u7b26\u4e32<\/h4>\n<p>python<\/p>\n<p>info &#061; &#034;EAR:{:.2f}&#034;.format(ear)<\/p>\n<ul>\n<li>\n<p>{:.2f}&#xff1a;\u6d6e\u70b9\u6570\u4fdd\u7559 2 \u4f4d\u5c0f\u6570<\/p>\n<\/li>\n<li>\n<p>\u4f8b&#xff1a;EAR:0.28<\/p>\n<\/li>\n<li>\n<p>\u4e5f\u53ef\u4ee5 f-string&#xff1a;f&#034;EAR:{ear:.2f}&#034;<\/p>\n<\/li>\n<\/ul>\n<h4>6.3 \u5199\u5230\u5de6\u4e0a\u89d2<\/h4>\n<p>python<\/p>\n<p>frame &#061; cv2AddChineseText(frame, info, (0, 30))<\/p>\n<ul>\n<li>\n<p>\u4f4d\u7f6e (0, 30)&#xff1a;\u5de6\u4e0a\u89d2&#xff0c;y&#061;30 \u662f\u4e3a\u4e86\u4e0d\u8d34\u7740\u8fb9\u7f18<\/p>\n<\/li>\n<li>\n<p>\u5fc5\u987b\u63a5\u8fd4\u56de\u503c&#xff1a;\u51fd\u6570\u8fd4\u56de\u65b0\u6570\u7ec4&#xff0c;\u4e0d\u63a5\u7b49\u4e8e\u6ca1\u5199<\/p>\n<\/li>\n<li>\n<p>\u5728 for \u5faa\u73af\u5185&#xff0c;\u6240\u4ee5\u6bcf\u5f20\u8138\u90fd\u4f1a\u5199\u4e00\u6b21\u2014\u2014\u591a\u5f20\u8138\u65f6\u540e\u5199\u7684\u4f1a\u8986\u76d6\u524d\u9762\u7684\u3002\u5355\u4eba\u573a\u666f\u6ca1\u95ee\u9898<\/p>\n<\/li>\n<\/ul>\n<p>\u8e29\u5751\u70b9&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u5fd8\u63a5\u8fd4\u56de\u503c \u2192 EAR \u6570\u5b57\u4e0d\u663e\u793a<\/p>\n<\/li>\n<li>\n<p>\u591a\u5f20\u8138\u65f6\u6240\u6709 EAR \u90fd\u5199\u5728 (0, 30)&#xff0c;\u4f1a\u4e92\u76f8\u8986\u76d6&#xff08;\u5982\u679c\u505a\u591a\u4eba\u7248&#xff0c;\u8981\u628a y \u968f\u8138\u4f4d\u7f6e\u504f\u79fb&#xff09;<\/p>\n<\/li>\n<\/ul>\n<hr \/>\n<h3>\u5757 7\ufe0f\u20e3 \u663e\u793a &#043; \u9000\u51fa<\/h3>\n<p>python<\/p>\n<p>    cv2.imshow(&#034;frame&#034;, frame)<\/p>\n<p>    if cv2.waitKey(1) &amp; 0xFF &#061;&#061; ord(&#034;q&#034;):<br \/>\n        break<\/p>\n<h4>7.1 imshow<\/h4>\n<ul>\n<li>\n<p>\u663e\u793a\u5f53\u524d\u5e27&#xff0c;\u7a97\u53e3\u540d &#034;frame&#034;<\/p>\n<\/li>\n<li>\n<p>\u6bcf\u5faa\u73af\u8c03\u4e00\u6b21&#xff0c;\u5f62\u6210\u89c6\u9891\u6d41<\/p>\n<\/li>\n<\/ul>\n<h4>7.2 waitKey(1)<\/h4>\n<ul>\n<li>\n<p>\u6bcf\u5e27\u7b49 1 \u6beb\u79d2<\/p>\n<\/li>\n<li>\n<p>\u8fd4\u56de\u503c&#xff1a;\u6309\u952e ASCII&#xff0c;\u6ca1\u6309\u952e\u8fd4\u56de -1<\/p>\n<\/li>\n<li>\n<p>\u5fc5\u987b\u6709&#xff0c;\u5426\u5219\u7a97\u53e3\u4e0d\u5237\u65b0 \/ \u5361\u6b7b<\/p>\n<\/li>\n<\/ul>\n<h4>7.3 &amp; 0xFF \u548c ord(&#034;q&#034;)<\/h4>\n<ul>\n<li>\n<p>&amp; 0xFF&#xff1a;\u53ea\u4fdd\u7559\u4f4e 8 \u4f4d&#xff0c;\u517c\u5bb9\u4e0d\u540c\u7cfb\u7edf&#xff08;\u67d0\u4e9b\u7cfb\u7edf\u6309\u952e\u7801 &gt; 255&#xff09;<\/p>\n<\/li>\n<li>\n<p>ord(&#034;q&#034;)&#xff1a;\u5b57\u7b26 &#039;q&#039; \u7684 ASCII&#xff08;113&#xff09;<\/p>\n<\/li>\n<li>\n<p>\u6309 q \u9000\u51fa<\/p>\n<\/li>\n<\/ul>\n<p>\u8e29\u5751\u70b9&#xff1a;<\/p>\n<ul>\n<li>\n<p>waitKey(0) \u4f1a\u5361\u5728\u7b2c\u4e00\u5e27<\/p>\n<\/li>\n<li>\n<p>imshow \u5728 for \u5faa\u73af\u5916&#xff08;\u53ea\u663e\u793a\u4e00\u6b21&#xff09;&#xff0c;\u8fd9\u662f\u5bf9\u7684&#xff1b;\u653e\u91cc\u9762\u4f1a\u91cd\u590d\u663e\u793a\u6d6a\u8d39<\/p>\n<\/li>\n<\/ul>\n<hr \/>\n<h3>\u5757 8\ufe0f\u20e3 \u6536\u5c3e<\/h3>\n<p>python<\/p>\n<p>cap.release()<br \/>\ncv2.destroyAllWindows()<\/p>\n<ul>\n<li>\n<p>cap.release()&#xff1a;\u91ca\u653e\u6444\u50cf\u5934&#xff0c;\u5426\u5219\u5176\u4ed6\u7a0b\u5e8f\u6253\u4e0d\u5f00<\/p>\n<\/li>\n<li>\n<p>cv2.destroyAllWindows()&#xff1a;\u5173\u95ed\u6240\u6709 OpenCV \u7a97\u53e3<\/p>\n<\/li>\n<li>\n<p>\u8fd9\u91cc\u6ca1\u6709 if __name__ &#061;&#061; &#034;__main__&#034;:&#xff0c;\u56e0\u4e3a\u6574\u6bb5\u662f\u6a21\u5757\u7ea7\u4ee3\u7801&#xff08;\u548c\u4e0a\u7bc7\u4e00\u8d77\u987a\u5e8f\u6267\u884c&#xff09;<\/p>\n<\/li>\n<\/ul>\n<hr \/>\n<h3>\u6574\u4f53\u6570\u636e\u6d41&#xff08;\u4e0b\u7bc7&#xff09;<\/h3>\n<p>text<\/p>\n<p>cap.read() \u2192 frame<br \/>\n    \u2502<br \/>\n    \u25bc BGR2GRAY<br \/>\ngray<br \/>\n    \u2502<br \/>\n    \u25bc detector(gray, 0)<br \/>\nfaces<br \/>\n    \u2502<br \/>\n    \u251c\u2500 len(faces)&#061;&#061;0 \u2192 counter &#061; 0<br \/>\n    \u2502<br \/>\n    \u25bc for face in faces<br \/>\n    predictor(frame, face) \u2192 shape (68,2)<br \/>\n    \u2502<br \/>\n    \u251c\u2500 rightEye &#061; shape[36:42]<br \/>\n    \u251c\u2500 leftEye  &#061; shape[42:48]<br \/>\n    \u2502<br \/>\n    \u25bc eye_aspect_ratio \u00d7 2 \u2192 \u5e73\u5747<br \/>\near<br \/>\n    \u2502<br \/>\n    \u251c\u2500 ear &lt; 0.3 \u2192 counter &#043;&#061; 1<br \/>\n    \u2502                 \u2514\u2500 counter &gt;&#061; 50 \u2192 \u5199&#034;!!!\u5371\u9669!!!&#034;<br \/>\n    \u2514\u2500 else      \u2192 counter &#061; 0<br \/>\n    \u2502<br \/>\n    \u25bc drawEye \u00d7 2 &#043; \u5199 EAR \u503c<br \/>\nframe&#039;<br \/>\n    \u2502<br \/>\n    \u25bc imshow &#043; waitKey(1)<br \/>\n    \u2502<br \/>\n    \u25bc &#039;q&#039; ? break : \u7ee7\u7eed<\/p>\n<p><span style=\"color:#1f3864\">\u56db\u3001\u8fd0\u884c\u6548\u679c<\/span><\/p>\n<p>\u8fd0\u884c\u7a0b\u5e8f\u540e&#xff0c;\u6444\u50cf\u5934\u753b\u9762\u91cc\u53cc\u773c\u88ab\u7eff\u8272\u8f6e\u5ed3\u5708\u4f4f&#xff0c;\u5de6\u4e0a\u89d2\u5b9e\u65f6\u663e\u793a EAR \u503c\u3002\u7741\u5927\u773c\u775b\u65f6\u6570\u503c\u5728 0.3 \u4ee5\u4e0a&#xff1b;\u95ed\u773c\u77ac\u95f4\u6389\u5230 0.2 \u4ee5\u4e0b&#xff1b;\u575a\u6301\u95ed\u773c\u7ea6 1.6 \u79d2&#xff0c;\u753b\u9762\u4e2d\u592e\u5c31\u4f1a\u4eae\u51fa\u7ea2\u8272\u7684&#034;!!!\u5371\u9669!!!&#034;\u3002<\/p>\n<p><span style=\"color:#1f3864\">\u4e94\u3001\u5c0f\u7ed3\u4e0e\u6539\u8fdb\u601d\u8def<\/span><\/p>\n<p>\u4e0a\u4e0b\u4e24\u7bc7\u5408\u8d77\u6765&#xff0c;\u5b8c\u6210\u4e86&#034;\u68c0\u6d4b \u2192 \u8ba1\u7b97 \u2192 \u62a5\u8b66&#034;\u7684\u5b8c\u6574\u95ed\u73af\u3002\u8fd9\u5957\u601d\u8def\u8fd8\u80fd\u6269\u5c55&#xff1a;\u5634\u5df4\u5468\u56f4\u7684\u70b9\u4e5f\u80fd\u7b97\u51fa&#034;\u5634\u5df4\u7eb5\u6a2a\u6bd4&#034;\u6765\u68c0\u6d4b\u6253\u54c8\u6b20&#xff0c;\u518d\u52a0\u4e0a\u70b9\u5934\u68c0\u6d4b&#xff0c;\u5c31\u662f\u4e00\u4e2a\u66f4\u5b9e\u7528\u7684\u75b2\u52b3\u9a7e\u9a76\u9884\u8b66\u7cfb\u7edf\u3002<\/p>\n<p>\u4f5c\u4e1a&#xff1a;\u628a\u9608\u503c 0.3 \u6539\u6210 0.25 \u548c 0.35&#xff0c;\u5206\u522b\u8bd5\u8bd5\u62a5\u8b66\u662f\u66f4\u7075\u654f\u8fd8\u662f\u66f4\u8fdf\u949d&#xff0c;\u60f3\u4e00\u60f3\u4e3a\u4ec0\u4e48\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u627f\u4e0a\u542f\u4e0b\u4e0a\u7bc7\u7b97\u597d\u4e86 EAR\u3001\u88c5\u597d\u4e86\u4e24\u4e2a\u6a21\u578b&#xff0c;\u672c\u7bc7\u8d34\u51fa\u75b2\u52b3\u68c0\u6d4b.py \u5269\u4e0b\u7684\u5b8c\u6574\u4ee3\u7801\u2014\u2014\u4e3b\u5faa\u73af&#xff0c;\u4e00\u5b57\u672a\u5220&#xff0c;\u5e76\u91cd\u70b9\u8bb2\u6e05\u695a\\&#8221;\u4e3a\u4ec0\u4e48\u4e0d\u4f1a\u628a\u6b63\u5e38\u7728\u773c\u8bef\u62a5\u6210\u75b2\u52b3\\&#8221;\u3002\u4e8c\u3001\u5b8c\u6574\u4ee3\u7801&#xff08;\u4e0b&#xff09;&#xff1a;\u4e3b\u5faa\u73af\u5757 1\ufe0f\u20e3 \u8bfb\u5e27pythonwhile True:ret, frame  cap.read()if not ret:breakwhile True&#xff1a;\u65e0\u9650\u5faa\u73af&#xff0c;\u76f4\u5230 breakcap.re<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[81],"topic":[],"class_list":["post-108492","post","type-post","status-publish","format-standard","hentry","category-server","tag-python"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Opencv-\u75b2\u52b3\u68c0\u6d4b2\u95ed\u773c\u62a5\u8b66\u7684\u4e3b\u5faa\u73af - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/108492.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Opencv-\u75b2\u52b3\u68c0\u6d4b2\u95ed\u773c\u62a5\u8b66\u7684\u4e3b\u5faa\u73af - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u4e00\u3001\u627f\u4e0a\u542f\u4e0b\u4e0a\u7bc7\u7b97\u597d\u4e86 EAR\u3001\u88c5\u597d\u4e86\u4e24\u4e2a\u6a21\u578b&#xff0c;\u672c\u7bc7\u8d34\u51fa\u75b2\u52b3\u68c0\u6d4b.py \u5269\u4e0b\u7684\u5b8c\u6574\u4ee3\u7801\u2014\u2014\u4e3b\u5faa\u73af&#xff0c;\u4e00\u5b57\u672a\u5220&#xff0c;\u5e76\u91cd\u70b9\u8bb2\u6e05\u695a&quot;\u4e3a\u4ec0\u4e48\u4e0d\u4f1a\u628a\u6b63\u5e38\u7728\u773c\u8bef\u62a5\u6210\u75b2\u52b3&quot;\u3002\u4e8c\u3001\u5b8c\u6574\u4ee3\u7801&#xff08;\u4e0b&#xff09;&#xff1a;\u4e3b\u5faa\u73af\u5757 1\ufe0f\u20e3 \u8bfb\u5e27pythonwhile True:ret, frame cap.read()if not ret:breakwhile True&#xff1a;\u65e0\u9650\u5faa\u73af&#xff0c;\u76f4\u5230 breakcap.re\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/108492.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-21T14:24:39+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/108492.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/108492.html\",\"name\":\"Opencv-\u75b2\u52b3\u68c0\u6d4b2\u95ed\u773c\u62a5\u8b66\u7684\u4e3b\u5faa\u73af - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-09-21T14:24:39+00:00\",\"dateModified\":\"2026-09-21T14:24:39+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/108492.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/108492.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/108492.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Opencv-\u75b2\u52b3\u68c0\u6d4b2\u95ed\u773c\u62a5\u8b66\u7684\u4e3b\u5faa\u73af\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Opencv-\u75b2\u52b3\u68c0\u6d4b2\u95ed\u773c\u62a5\u8b66\u7684\u4e3b\u5faa\u73af - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/108492.html","og_locale":"zh_CN","og_type":"article","og_title":"Opencv-\u75b2\u52b3\u68c0\u6d4b2\u95ed\u773c\u62a5\u8b66\u7684\u4e3b\u5faa\u73af - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u4e00\u3001\u627f\u4e0a\u542f\u4e0b\u4e0a\u7bc7\u7b97\u597d\u4e86 EAR\u3001\u88c5\u597d\u4e86\u4e24\u4e2a\u6a21\u578b&#xff0c;\u672c\u7bc7\u8d34\u51fa\u75b2\u52b3\u68c0\u6d4b.py \u5269\u4e0b\u7684\u5b8c\u6574\u4ee3\u7801\u2014\u2014\u4e3b\u5faa\u73af&#xff0c;\u4e00\u5b57\u672a\u5220&#xff0c;\u5e76\u91cd\u70b9\u8bb2\u6e05\u695a\"\u4e3a\u4ec0\u4e48\u4e0d\u4f1a\u628a\u6b63\u5e38\u7728\u773c\u8bef\u62a5\u6210\u75b2\u52b3\"\u3002\u4e8c\u3001\u5b8c\u6574\u4ee3\u7801&#xff08;\u4e0b&#xff09;&#xff1a;\u4e3b\u5faa\u73af\u5757 1\ufe0f\u20e3 \u8bfb\u5e27pythonwhile True:ret, frame cap.read()if not ret:breakwhile True&#xff1a;\u65e0\u9650\u5faa\u73af&#xff0c;\u76f4\u5230 breakcap.re","og_url":"https:\/\/www.wsisp.com\/helps\/108492.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-09-21T14:24:39+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/108492.html","url":"https:\/\/www.wsisp.com\/helps\/108492.html","name":"Opencv-\u75b2\u52b3\u68c0\u6d4b2\u95ed\u773c\u62a5\u8b66\u7684\u4e3b\u5faa\u73af - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-09-21T14:24:39+00:00","dateModified":"2026-09-21T14:24:39+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/108492.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/108492.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/108492.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Opencv-\u75b2\u52b3\u68c0\u6d4b2\u95ed\u773c\u62a5\u8b66\u7684\u4e3b\u5faa\u73af"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/108492","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=108492"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/108492\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=108492"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=108492"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=108492"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=108492"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}