{"id":73994,"date":"2026-02-08T22:10:03","date_gmt":"2026-02-08T14:10:03","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/73994.html"},"modified":"2026-02-08T22:10:03","modified_gmt":"2026-02-08T14:10:03","slug":"%e5%9f%ba%e4%ba%8e-opencv-%e4%b8%8e-dlib-%e7%9a%84%e4%ba%ba%e8%84%b8%e6%9b%bf%e6%8d%a2","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/73994.html","title":{"rendered":"\u57fa\u4e8e OpenCV \u4e0e Dlib \u7684\u4eba\u8138\u66ff\u6362"},"content":{"rendered":"<h3>\u4e00\u3001\u6838\u5fc3\u539f\u7406<\/h3>\n<p>1.\u68c0\u6d4b\u4e24\u5f20\u4eba\u8138\u56fe\u7247\u7684 68 \u4e2a\u7279\u5f81\u5173\u952e\u70b9&#xff1b;<\/p>\n<p>2.\u6839\u636e\u5173\u952e\u70b9\u8ba1\u7b97\u4eba\u8138\u95f4\u7684\u4eff\u5c04\u53d8\u6362\u77e9\u9635&#xff0c;\u5b9e\u73b0\u4eba\u8138\u4f4d\u7f6e \/ \u89d2\u5ea6\u7684\u5bf9\u9f50&#xff1b;<\/p>\n<p>3.\u751f\u6210\u4eba\u8138\u63a9\u819c&#xff0c;\u533a\u5206\u4eba\u8138\u533a\u57df\u4e0e\u80cc\u666f\u533a\u57df&#xff1b;<\/p>\n<p>4.\u5bf9\u66ff\u6362\u4eba\u8138\u8fdb\u884c\u989c\u8272\u5f52\u4e00\u5316&#xff0c;\u5339\u914d\u76ee\u6807\u4eba\u8138\u7684\u8272\u5f69\u98ce\u683c&#xff1b;<\/p>\n<p>5.\u878d\u5408\u63a9\u819c\u533a\u57df&#xff0c;\u5b8c\u6210\u6700\u7ec8\u7684\u6362\u8138\u6548\u679c\u3002<\/p>\n<h3>\u4e8c\u3001\u73af\u5883\u51c6\u5907<\/h3>\n<p>1.\u4e0b\u8f7d\u4eba\u8138\u5173\u952e\u70b9\u6a21\u578b<\/p>\n<p>\u9700\u4e0b\u8f7d Dlib \u5b98\u65b9\u7684 68 \u4e2a\u4eba\u8138\u5173\u952e\u70b9\u9884\u6d4b\u6a21\u578b&#xff1a;shape_predictor_68_face_landmarks.dat<\/p>\n<h3>\u4e09\u3001\u4ee3\u7801\u89e3\u6790<\/h3>\n<h4>1. \u4eba\u8138\u5173\u952e\u70b9\u5206\u533a<\/h4>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u4eba\u8138\u7684 68 \u4e2a\u5173\u952e\u70b9\u53ef\u5206\u4e3a\u4e0d\u540c\u533a\u57df&#xff08;\u5982\u4e0b\u5df4\u3001\u7709\u6bdb\u3001\u773c\u775b\u3001\u9f3b\u5b50\u3001\u5634\u5df4\u7b49&#xff09;&#xff0c;\u6211\u4eec\u53ea\u9700\u5173\u6ce8\u6838\u5fc3\u9762\u90e8\u533a\u57df&#xff08;\u6392\u9664\u4e0b\u5df4&#xff09;&#xff0c;\u7528\u4e8e\u540e\u7eed\u63a9\u819c\u751f\u6210\u548c\u53d8\u6362\u8ba1\u7b97<\/p>\n<p>import cv2<br \/>\nimport dlib<br \/>\nimport numpy as np<\/p>\n<p># \u4eba\u813868\u5173\u952e\u70b9\u5206\u533a\u5b9a\u4e49<br \/>\nJAW_POINTS &#061; list(range(0,17))         # \u4e0b\u5df4\u5173\u952e\u70b9<br \/>\nRIGHT_BROW_POINTS &#061; list(range(17,22)) # \u53f3\u7709\u6bdb<br \/>\nLEFT_BROW_POINTS &#061; list(range(22,27))  # \u5de6\u7709\u6bdb<br \/>\nNOSE_POINTS &#061; list(range(27,35))       # \u9f3b\u5b50<br \/>\nRIGHT_EYE_POINTS &#061; list(range(36,42))  # \u53f3\u773c<br \/>\nLEFT_EYE_POINTS &#061; list(range(42,48))   # \u5de6\u773c<br \/>\nMOUTH_POINTS &#061; list(range(48,61))      # \u5634\u5df4<\/p>\n<p># \u6838\u5fc3\u9762\u90e8\u5173\u952e\u70b9&#xff08;\u6392\u9664\u4e0b\u5df4&#xff0c;\u4ec5\u4fdd\u7559\u4e94\u5b98\u533a\u57df&#xff09;<br \/>\nFACE_POINTS &#061; list(range(17,68))<br \/>\n# \u7ec4\u5408\u5173\u952e\u533a\u57df&#xff0c;\u7528\u4e8e\u540e\u7eed\u53d8\u6362\u8ba1\u7b97<br \/>\nPOINTS &#061; [LEFT_BROW_POINTS&#043;RIGHT_EYE_POINTS&#043;LEFT_EYE_POINTS &#043;RIGHT_BROW_POINTS &#043; NOSE_POINTS &#043; MOUTH_POINTS]<br \/>\nPOINTStuple &#061; tuple(POINTS)  # \u8f6c\u6362\u4e3a\u5143\u7ec4&#xff0c;\u65b9\u4fbf\u540e\u7eed\u7d22\u5f15<\/p>\n<h4>2. \u51fd\u6570 &#xff1a;\u751f\u6210\u4eba\u8138\u63a9\u819c<\/h4>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u63a9\u819c&#xff08;Mask&#xff09;\u7684\u4f5c\u7528\u662f\u6807\u8bb0\u51fa\u56fe\u7247\u4e2d\u7684\u4eba\u8138\u533a\u57df&#xff0c;\u540e\u7eed\u4ec5\u5bf9\u8be5\u533a\u57df\u8fdb\u884c\u66ff\u6362\u64cd\u4f5c&#xff0c;\u907f\u514d\u5f71\u54cd\u80cc\u666f\u3002\u901a\u8fc7\u5173\u952e\u70b9\u7684\u51f8\u5305&#xff08;convexHull&#xff09;\u751f\u6210\u4eba\u8138\u8f6e\u5ed3&#xff0c;\u518d\u586b\u5145\u5e76\u9ad8\u65af\u6a21\u7cca\u4f7f\u8fb9\u7f18\u66f4\u81ea\u7136&#xff1a;<\/p>\n<p>def getFaceMask(im, keyPoints):<br \/>\n    &#034;&#034;&#034;<br \/>\n    \u6839\u636e\u4eba\u8138\u5173\u952e\u70b9\u751f\u6210\u4eba\u8138\u63a9\u819c<br \/>\n    :param im: \u8f93\u5165\u56fe\u50cf<br \/>\n    :param keyPoints: \u4eba\u813868\u5173\u952e\u70b9\u77e9\u9635<br \/>\n    :return: \u5f52\u4e00\u5316\u4e14\u9ad8\u65af\u6a21\u7cca\u540e\u7684\u4eba\u8138\u63a9\u819c&#xff08;0-1\u4e4b\u95f4&#xff09;<br \/>\n    &#034;&#034;&#034;<br \/>\n    # \u521b\u5efa\u4e0e\u539f\u56fe\u540c\u5c3a\u5bf8\u7684\u51680\u77e9\u9635&#xff08;\u5355\u901a\u9053&#xff09;<br \/>\n    im_mask &#061; np.zeros(im.shape[:2], dtype&#061;np.float64)<br \/>\n    for p in POINTS:<br \/>\n        # \u6839\u636e\u5173\u952e\u70b9\u751f\u6210\u51f8\u5305&#xff08;\u4eba\u8138\u8f6e\u5ed3&#xff09;<br \/>\n        hull &#061; cv2.convexHull(keyPoints[p])<br \/>\n        # \u586b\u5145\u51f8\u5305\u533a\u57df\u4e3a1&#xff08;\u6807\u8bb0\u4eba\u8138\u533a\u57df&#xff09;<br \/>\n        cv2.fillConvexPoly(im_mask, hull, color&#061;1)<\/p>\n<p>    # \u5c06\u5355\u901a\u9053\u63a9\u819c\u8f6c\u6362\u4e3a3\u901a\u9053&#xff08;\u5339\u914dRGB\u56fe\u50cf&#xff09;<br \/>\n    im_mask &#061; np.array([im_mask, im_mask, im_mask]).transpose((1,2,0))<br \/>\n    # \u9ad8\u65af\u6a21\u7cca&#xff1a;45&#215;45\u6838\u4f7f\u63a9\u819c\u8fb9\u7f18\u8fc7\u6e21\u66f4\u81ea\u7136&#xff0c;\u907f\u514d\u66ff\u6362\u540e\u8fb9\u7f18\u751f\u786c<br \/>\n    im_mask &#061; cv2.GaussianBlur(im_mask, (45,45), 0)<br \/>\n    return im_mask<\/p>\n<h4>3. \u51fd\u6570 &#xff1a;\u8ba1\u7b97\u4eff\u5c04\u53d8\u6362\u77e9\u9635<\/h4>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u8981\u5c06 B \u4eba\u8138\u5bf9\u9f50\u5230 A \u4eba\u8138\u7684\u4f4d\u7f6e \/ \u89d2\u5ea6&#xff0c;\u9700\u8ba1\u7b97\u4e24\u8005\u7684\u4eff\u5c04\u53d8\u6362\u77e9\u9635 M\u3002\u6838\u5fc3\u6b65\u9aa4\u662f\u5f52\u4e00\u5316\u5173\u952e\u70b9 &#043; \u5947\u5f02\u503c\u5206\u89e3&#xff08;SVD&#xff09; \u6c42\u89e3\u65cb\u8f6c\u77e9\u9635&#xff0c;\u6700\u7ec8\u5f97\u5230\u5b8c\u6574\u7684\u4eff\u5c04\u53d8\u6362\u77e9\u9635<\/p>\n<p>def getM(points1, points2):<br \/>\n    &#034;&#034;&#034;<br \/>\n    \u8ba1\u7b97\u4ecepoints1\u5230points2\u7684\u4eff\u5c04\u53d8\u6362\u77e9\u9635<br \/>\n    :param points1: \u76ee\u6807\u4eba\u8138\u5173\u952e\u70b9&#xff08;A\u56fe&#xff09;<br \/>\n    :param points2: \u6e90\u4eba\u8138\u5173\u952e\u70b9&#xff08;B\u56fe&#xff09;<br \/>\n    :return: \u4eff\u5c04\u53d8\u6362\u77e9\u9635M<br \/>\n    &#034;&#034;&#034;<br \/>\n    # \u8f6c\u6362\u4e3a\u6d6e\u70b9\u578b&#xff0c;\u907f\u514d\u6574\u6570\u8fd0\u7b97\u8bef\u5dee<br \/>\n    points1 &#061; points1.astype(np.float64)<br \/>\n    points2 &#061; points2.astype(np.float64)<\/p>\n<p>    # \u8ba1\u7b97\u5173\u952e\u70b9\u7684\u5747\u503c&#xff08;\u4e2d\u5fc3\u4f4d\u7f6e&#xff09;<br \/>\n    c1 &#061; np.mean(points1, axis&#061;0)<br \/>\n    c2 &#061; np.mean(points2, axis&#061;0)<\/p>\n<p>    # \u5f52\u4e00\u5316&#xff1a;\u51cf\u53bb\u5747\u503c&#xff08;\u6d88\u9664\u5e73\u79fb\u5dee\u5f02&#xff09;<br \/>\n    points1 -&#061; c1<br \/>\n    points2 -&#061; c2<\/p>\n<p>    # \u8ba1\u7b97\u6807\u51c6\u5dee&#xff08;\u6d88\u9664\u5c3a\u5ea6\u5dee\u5f02&#xff09;<br \/>\n    s1 &#061; np.std(points1)<br \/>\n    s2 &#061; np.std(points2)<\/p>\n<p>    # \u5f52\u4e00\u5316&#xff1a;\u9664\u4ee5\u6807\u51c6\u5dee<br \/>\n    points1 \/&#061; s1<br \/>\n    points2 \/&#061; s2<\/p>\n<p>    # \u5947\u5f02\u503c\u5206\u89e3&#xff08;SVD&#xff09;\u6c42\u89e3\u65cb\u8f6c\u77e9\u9635<br \/>\n    U, S, Vt &#061; np.linalg.svd(points1.T &#064; points2)<br \/>\n    R &#061; (U &#064; Vt).T  # \u65cb\u8f6c\u77e9\u9635<\/p>\n<p>    # \u7ec4\u5408\u4eff\u5c04\u53d8\u6362\u77e9\u9635&#xff1a;\u5c3a\u5ea6*\u65cb\u8f6c &#043; \u5e73\u79fb<br \/>\n    M &#061; np.hstack(((s2\/s1)*R, c2.T &#8211; (s2\/s1)*R &#064; c1.T))<br \/>\n    return M<\/p>\n<h4>4. \u51fd\u6570 &#xff1a;\u4eba\u8138\u5173\u952e\u70b9\u68c0\u6d4b<\/h4>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u57fa\u4e8e Dlib \u7684\u68c0\u6d4b\u5668\u548c\u5173\u952e\u70b9\u9884\u6d4b\u6a21\u578b&#xff0c;\u63d0\u53d6\u56fe\u7247\u4e2d\u7684 68 \u4e2a\u4eba\u8138\u5173\u952e\u70b9&#xff1a;<\/p>\n<p>def getKeyPoints(im):<br \/>\n    &#034;&#034;&#034;<br \/>\n    \u68c0\u6d4b\u56fe\u50cf\u4e2d\u7684\u4eba\u8138\u5173\u952e\u70b9<br \/>\n    :param im: \u8f93\u5165\u56fe\u50cf<br \/>\n    :return: 68\u4e2a\u5173\u952e\u70b9\u7684\u77e9\u9635&#xff08;68&#215;2&#xff09;<br \/>\n    &#034;&#034;&#034;<br \/>\n    # \u68c0\u6d4b\u4eba\u8138\u4f4d\u7f6e&#xff08;\u77e9\u5f62\u6846&#xff09;<br \/>\n    detector &#061; dlib.get_frontal_face_detector()<br \/>\n    rects &#061; detector(im, 1)<br \/>\n    # \u9884\u6d4b\u5173\u952e\u70b9&#xff08;\u53d6\u7b2c\u4e00\u4e2a\u68c0\u6d4b\u5230\u7684\u4eba\u8138&#xff09;<br \/>\n    predictor &#061; dlib.shape_predictor(&#034;shape_predictor_68_face_landmarks.dat&#034;)<br \/>\n    shape &#061; predictor(im, rects[0])<br \/>\n    # \u8f6c\u6362\u4e3a\u77e9\u9635\u683c\u5f0f&#xff08;\u65b9\u4fbf\u540e\u7eed\u8ba1\u7b97&#xff09;<br \/>\n    key_points &#061; np.matrix([[p.x, p.y] for p in shape.parts()])<br \/>\n    return key_points<\/p>\n<h4>5. \u51fd\u6570 &#xff1a;\u989c\u8272\u5f52\u4e00\u5316<\/h4>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u76f4\u63a5\u66ff\u6362\u4eba\u8138\u4f1a\u51fa\u73b0\u8272\u5f69\u4e0d\u5339\u914d\u7684\u95ee\u9898&#xff0c;\u901a\u8fc7\u9ad8\u65af\u6ee4\u6ce2\u8ba1\u7b97\u8272\u5f69\u6743\u91cd&#xff0c;\u5c06 B \u4eba\u8138\u7684\u8272\u5f69\u98ce\u683c\u5339\u914d\u5230 A \u4eba\u8138&#xff1a;<\/p>\n<p>def normalcolor(a, b):<br \/>\n    &#034;&#034;&#034;<br \/>\n    \u5c06B\u56fe\u7684\u8272\u5f69\u98ce\u683c\u5339\u914d\u5230A\u56fe<br \/>\n    :param a: \u76ee\u6807\u56fe\u50cf&#xff08;A\u56fe&#xff09;<br \/>\n    :param b: \u6e90\u56fe\u50cf&#xff08;\u53d8\u6362\u540e\u7684B\u56fe&#xff09;<br \/>\n    :return: \u8272\u5f69\u5f52\u4e00\u5316\u540e\u7684B\u56fe<br \/>\n    &#034;&#034;&#034;<br \/>\n    # \u5927\u6838\u9ad8\u65af\u6ee4\u6ce2&#xff1a;\u63d0\u53d6\u56fe\u50cf\u7684\u6574\u4f53\u8272\u5f69\u98ce\u683c&#xff08;\u5ffd\u7565\u7ec6\u8282&#xff09;<br \/>\n    ksize &#061; (111, 111)<br \/>\n    aGauss &#061; cv2.GaussianBlur(a, ksize, 0)<br \/>\n    bGauss &#061; cv2.GaussianBlur(b, ksize, 0)<\/p>\n<p>    # \u8ba1\u7b97\u8272\u5f69\u6743\u91cd&#xff08;\u5904\u7406\u96640\u65e0\u7a77\u5927\u7684\u60c5\u51b5&#xff09;<br \/>\n    weight &#061; aGauss \/ bGauss<br \/>\n    weight[np.isinf(weight)] &#061; 0  # \u65e0\u7a77\u5927\u503c\u7f6e0<\/p>\n<p>    # \u5e94\u7528\u6743\u91cd&#xff0c;\u5339\u914d\u8272\u5f69<br \/>\n    return b * weight<\/p>\n<h4>6. \u6574\u5408\u6240\u6709\u6b65\u9aa4\u5b8c\u6210\u6362\u8138<\/h4>\n<p>if __name__ &#061;&#061; &#034;__main__&#034;:<br \/>\n    # 1. \u8bfb\u53d6\u56fe\u7247<br \/>\n    a &#061; cv2.imread(&#034;0.png&#034;)  # \u76ee\u6807\u56fe\u7247&#xff08;\u4fdd\u7559\u80cc\u666f&#xff0c;\u66ff\u6362\u4eba\u8138&#xff09;<br \/>\n    b &#061; cv2.imread(&#034;7.png&#034;)  # \u6e90\u56fe\u7247&#xff08;\u63d0\u4f9b\u8981\u66ff\u6362\u7684\u4eba\u8138&#xff09;<\/p>\n<p>    # 2. \u521d\u59cb\u5316\u68c0\u6d4b\u5668\u548c\u9884\u6d4b\u5668<br \/>\n    detector &#061; dlib.get_frontal_face_detector()<br \/>\n    predictor &#061; dlib.shape_predictor(&#034;shape_predictor_68_face_landmarks.dat&#034;)<\/p>\n<p>    # 3. \u68c0\u6d4b\u4eba\u8138\u5173\u952e\u70b9<br \/>\n    aKeyPoints &#061; getKeyPoints(a)<br \/>\n    bKeyPoints &#061; getKeyPoints(b)<\/p>\n<p>    # 4. \u751f\u6210\u4eba\u8138\u63a9\u819c<br \/>\n    aMask &#061; getFaceMask(a, aKeyPoints)<br \/>\n    bMask &#061; getFaceMask(b, bKeyPoints)<\/p>\n<p>    # 5. \u8ba1\u7b97\u4eff\u5c04\u53d8\u6362\u77e9\u9635&#xff08;B\u5bf9\u9f50\u5230A&#xff09;<br \/>\n    M &#061; getM(aKeyPoints[POINTStuple], bKeyPoints[POINTStuple])<\/p>\n<p>    # 6. \u53d8\u6362B\u7684\u63a9\u819c\u548c\u4eba\u8138\u56fe\u50cf<br \/>\n    dsize &#061; a.shape[:2][::-1]  # \u76ee\u6807\u5c3a\u5bf8&#xff08;\u5bbd, \u9ad8&#xff09;<br \/>\n    # \u53d8\u6362B\u7684\u63a9\u819c<br \/>\n    bMaskWarp &#061; cv2.warpAffine(bMask, M, dsize, borderMode&#061;cv2.BORDER_TRANSPARENT, flags&#061;cv2.WARP_INVERSE_MAP)<br \/>\n    # \u53d8\u6362B\u7684\u4eba\u8138\u56fe\u50cf<br \/>\n    bWrap &#061; cv2.warpAffine(b, M, dsize, borderMode&#061;cv2.BORDER_TRANSPARENT, flags&#061;cv2.WARP_INVERSE_MAP)<\/p>\n<p>    # 7. \u878d\u5408\u63a9\u819c&#xff08;\u53d6A\u548c\u53d8\u6362\u540eB\u63a9\u819c\u7684\u6700\u5927\u503c&#xff09;<br \/>\n    mask &#061; np.max([aMask, bMaskWarp], axis&#061;0)<\/p>\n<p>    # 8. \u989c\u8272\u5f52\u4e00\u5316<br \/>\n    bcolor &#061; normalcolor(a, bWrap)<\/p>\n<p>    # 9. \u878d\u5408\u56fe\u50cf&#xff1a;\u63a9\u819c\u533a\u57df\u7528B\u7684\u4eba\u8138&#xff0c;\u975e\u63a9\u819c\u533a\u57df\u7528A\u7684\u80cc\u666f<br \/>\n    out &#061; a * (1.0 &#8211; mask) &#043; bcolor * mask<\/p>\n<p>    # 10. \u663e\u793a\u7ed3\u679c<br \/>\n    cv2.imshow(&#034;\u539f\u59cb\u56feA&#034;, a)<br \/>\n    cv2.imshow(&#034;\u539f\u59cb\u56feB&#034;, b)<br \/>\n    cv2.imshow(&#034;\u6362\u8138\u7ed3\u679c&#034;, out \/ 255)  # \u5f52\u4e00\u5316\u52300-1\u663e\u793a<br \/>\n    cv2.waitKey(0)<br \/>\n    cv2.destroyAllWindows()<\/p>\n<h3>\u56db\u3001\u5173\u952e\u53c2\u6570\u8c03\u6574\u6280\u5de7<\/h3>\n<li>\n<p>\u9ad8\u65af\u6a21\u7cca\u6838\u5927\u5c0f&#xff1a;getFaceMask\u4e2d\u7684(45,45)\u548cnormalcolor\u4e2d\u7684(111,111)\u662f\u6838\u5fc3\u53c2\u6570\u3002\u6838\u8d8a\u5927&#xff0c;\u8fb9\u7f18\u8d8a\u6a21\u7cca\u81ea\u7136&#xff0c;\u4f46\u8fc7\u5927\u4f1a\u5bfc\u81f4\u4eba\u8138\u7ec6\u8282\u4e22\u5931&#xff1b;\u6838\u8d8a\u5c0f&#xff0c;\u8fb9\u7f18\u8d8a\u6e05\u6670&#xff0c;\u4f46\u53ef\u80fd\u51fa\u73b0\u751f\u786c\u7684\u62fc\u63a5\u75d5\u8ff9&#xff0c;\u5efa\u8bae\u6839\u636e\u56fe\u7247\u5206\u8fa8\u7387\u8c03\u6574&#xff08;\u5206\u8fa8\u7387\u9ad8\u5219\u6838\u5927&#xff0c;\u53cd\u4e4b\u5219\u5c0f&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u5173\u952e\u70b9\u533a\u57df\u9009\u62e9&#xff1a;\u672c\u6587\u6392\u9664\u4e86\u4e0b\u5df4\u5173\u952e\u70b9&#xff08;\u4ec5\u7528 17-68&#xff09;&#xff0c;\u82e5\u9700\u66ff\u6362\u5b8c\u6574\u4eba\u8138&#xff08;\u5305\u62ec\u4e0b\u5df4&#xff09;&#xff0c;\u53ef\u5c06POINTS\u6539\u4e3aFACE_POINTS\u3002<\/p>\n<\/li>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u6838\u5fc3\u539f\u74061.\u68c0\u6d4b\u4e24\u5f20\u4eba\u8138\u56fe\u7247\u7684 68 \u4e2a\u7279\u5f81\u5173\u952e\u70b9&#xff1b;2.\u6839\u636e\u5173\u952e\u70b9\u8ba1\u7b97\u4eba\u8138\u95f4\u7684\u4eff\u5c04\u53d8\u6362\u77e9\u9635&#xff0c;\u5b9e\u73b0\u4eba\u8138\u4f4d\u7f6e \/ \u89d2\u5ea6\u7684\u5bf9\u9f50&#xff1b;3.\u751f\u6210\u4eba\u8138\u63a9\u819c&#xff0c;\u533a\u5206\u4eba\u8138\u533a\u57df\u4e0e\u80cc\u666f\u533a\u57df&#xff1b;4.\u5bf9\u66ff\u6362\u4eba\u8138\u8fdb\u884c\u989c\u8272\u5f52\u4e00\u5316&#xff0c;\u5339\u914d\u76ee\u6807\u4eba\u8138\u7684\u8272\u5f69\u98ce\u683c&#xff1b;5.\u878d\u5408\u63a9\u819c\u533a\u57df&#xff0c;\u5b8c\u6210\u6700\u7ec8\u7684\u6362\u8138\u6548\u679c\u3002\u4e8c\u3001\u73af\u5883\u51c6\u59071.\u4e0b\u8f7d\u4eba\u8138\u5173\u952e\u70b9\u6a21\u578b\u9700\u4e0b\u8f7d Dlib \u5b98\u65b9\u7684 68 \u4e2a\u4eba\u8138\u5173\u952e\u70b9\u9884\u6d4b\u6a21\u578b&#xff1a;sha<\/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":[1460,50,523],"topic":[],"class_list":["post-73994","post","type-post","status-publish","format-standard","hentry","category-server","tag-opencv","tag-50","tag-523"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u57fa\u4e8e OpenCV \u4e0e Dlib \u7684\u4eba\u8138\u66ff\u6362 - \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\/73994.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u57fa\u4e8e OpenCV \u4e0e Dlib \u7684\u4eba\u8138\u66ff\u6362 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u4e00\u3001\u6838\u5fc3\u539f\u74061.\u68c0\u6d4b\u4e24\u5f20\u4eba\u8138\u56fe\u7247\u7684 68 \u4e2a\u7279\u5f81\u5173\u952e\u70b9&#xff1b;2.\u6839\u636e\u5173\u952e\u70b9\u8ba1\u7b97\u4eba\u8138\u95f4\u7684\u4eff\u5c04\u53d8\u6362\u77e9\u9635&#xff0c;\u5b9e\u73b0\u4eba\u8138\u4f4d\u7f6e \/ \u89d2\u5ea6\u7684\u5bf9\u9f50&#xff1b;3.\u751f\u6210\u4eba\u8138\u63a9\u819c&#xff0c;\u533a\u5206\u4eba\u8138\u533a\u57df\u4e0e\u80cc\u666f\u533a\u57df&#xff1b;4.\u5bf9\u66ff\u6362\u4eba\u8138\u8fdb\u884c\u989c\u8272\u5f52\u4e00\u5316&#xff0c;\u5339\u914d\u76ee\u6807\u4eba\u8138\u7684\u8272\u5f69\u98ce\u683c&#xff1b;5.\u878d\u5408\u63a9\u819c\u533a\u57df&#xff0c;\u5b8c\u6210\u6700\u7ec8\u7684\u6362\u8138\u6548\u679c\u3002\u4e8c\u3001\u73af\u5883\u51c6\u59071.\u4e0b\u8f7d\u4eba\u8138\u5173\u952e\u70b9\u6a21\u578b\u9700\u4e0b\u8f7d Dlib \u5b98\u65b9\u7684 68 \u4e2a\u4eba\u8138\u5173\u952e\u70b9\u9884\u6d4b\u6a21\u578b&#xff1a;sha\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/73994.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-08T14:10:03+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\/73994.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/73994.html\",\"name\":\"\u57fa\u4e8e OpenCV \u4e0e Dlib \u7684\u4eba\u8138\u66ff\u6362 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-08T14:10:03+00:00\",\"dateModified\":\"2026-02-08T14:10:03+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/73994.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/73994.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/73994.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u57fa\u4e8e OpenCV \u4e0e Dlib \u7684\u4eba\u8138\u66ff\u6362\"}]},{\"@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":"\u57fa\u4e8e OpenCV \u4e0e Dlib \u7684\u4eba\u8138\u66ff\u6362 - \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\/73994.html","og_locale":"zh_CN","og_type":"article","og_title":"\u57fa\u4e8e OpenCV \u4e0e Dlib \u7684\u4eba\u8138\u66ff\u6362 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u4e00\u3001\u6838\u5fc3\u539f\u74061.\u68c0\u6d4b\u4e24\u5f20\u4eba\u8138\u56fe\u7247\u7684 68 \u4e2a\u7279\u5f81\u5173\u952e\u70b9&#xff1b;2.\u6839\u636e\u5173\u952e\u70b9\u8ba1\u7b97\u4eba\u8138\u95f4\u7684\u4eff\u5c04\u53d8\u6362\u77e9\u9635&#xff0c;\u5b9e\u73b0\u4eba\u8138\u4f4d\u7f6e \/ \u89d2\u5ea6\u7684\u5bf9\u9f50&#xff1b;3.\u751f\u6210\u4eba\u8138\u63a9\u819c&#xff0c;\u533a\u5206\u4eba\u8138\u533a\u57df\u4e0e\u80cc\u666f\u533a\u57df&#xff1b;4.\u5bf9\u66ff\u6362\u4eba\u8138\u8fdb\u884c\u989c\u8272\u5f52\u4e00\u5316&#xff0c;\u5339\u914d\u76ee\u6807\u4eba\u8138\u7684\u8272\u5f69\u98ce\u683c&#xff1b;5.\u878d\u5408\u63a9\u819c\u533a\u57df&#xff0c;\u5b8c\u6210\u6700\u7ec8\u7684\u6362\u8138\u6548\u679c\u3002\u4e8c\u3001\u73af\u5883\u51c6\u59071.\u4e0b\u8f7d\u4eba\u8138\u5173\u952e\u70b9\u6a21\u578b\u9700\u4e0b\u8f7d Dlib \u5b98\u65b9\u7684 68 \u4e2a\u4eba\u8138\u5173\u952e\u70b9\u9884\u6d4b\u6a21\u578b&#xff1a;sha","og_url":"https:\/\/www.wsisp.com\/helps\/73994.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-08T14:10:03+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\/73994.html","url":"https:\/\/www.wsisp.com\/helps\/73994.html","name":"\u57fa\u4e8e OpenCV \u4e0e Dlib \u7684\u4eba\u8138\u66ff\u6362 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-08T14:10:03+00:00","dateModified":"2026-02-08T14:10:03+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/73994.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/73994.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/73994.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u57fa\u4e8e OpenCV \u4e0e Dlib \u7684\u4eba\u8138\u66ff\u6362"}]},{"@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\/73994","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=73994"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/73994\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=73994"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=73994"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=73994"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=73994"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}