{"id":65536,"date":"2026-01-25T08:24:35","date_gmt":"2026-01-25T00:24:35","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/65536.html"},"modified":"2026-01-25T08:24:35","modified_gmt":"2026-01-25T00:24:35","slug":"%e8%ae%a1%e7%ae%97%e6%9c%ba%e8%a7%86%e8%a7%89opencv%e4%b9%8b%e6%8c%87%e7%ba%b9%e8%af%86%e5%88%ab%e8%a1%a5%e5%85%85%e5%9b%be%e7%89%87%e6%8b%bc%e6%8e%a5%e6%80%9d%e8%80%83","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/65536.html","title":{"rendered":"\u8ba1\u7b97\u673a\u89c6\u89c9opencv\u4e4b\u6307\u7eb9\u8bc6\u522b\u8865\u5145&amp;\u56fe\u7247\u62fc\u63a5&amp;\u601d\u8003"},"content":{"rendered":"<p>\u4e00\u3001\u6307\u7eb9\u8bc6\u522b<\/p>\n<p>1.\u4e0a\u7bc7\u535a\u5ba2\u4e2d\u8bb2\u5230\u6307\u7eb9\u8bc6\u522b\u4ee5\u53ca\u5bf9\u5339\u914d\u4e0a\u7684\u70b9\u6807\u51fa&#xff0c;\u8fd9\u6b21\u6211\u4eec\u5b9e\u73b0\u8ba9\u5339\u914d\u5bf9\u5e94\u7684\u70b9\u8fde\u63a5\u8d77\u6765&#xff0c;\u4ece\u8fde\u63a5\u7684\u7ebf\u4e0a\u53cd\u5e94\u5339\u914d\u7684\u7a0b\u5ea6<\/p>\n<p>\u8fd9\u91cc\u548c\u4e0a\u7bc7\u535a\u5ba2\u4e2d\u4ee3\u7801\u4e00\u6837&#xff0c;\u53ea\u4e0d\u8fc7\u5728\u51fd\u6570\u4e2d\u7a0d\u6539\u52a8\u4e86&#xff0c;\u6dfb\u52a0\u4e86src_matches&#061;[]\u8fd9\u4e2a\u53d8\u91cf&#xff0c;\u4ee5\u53ca\u540e\u9762\u5bf9\u5176\u7684\u4f7f\u7528<\/p>\n<p>import cv2<br \/>\ndef cv_show(name,img):<br \/>\n    cv2.imshow(name,img)<br \/>\n    cv2.waitKey(0)<br \/>\ndef verification(src,model,show_matchs&#061;False):<br \/>\n    sift&#061;cv2.SIFT_create()<br \/>\n    kp1,des1&#061;sift.detectAndCompute(src,None)<br \/>\n    kp2,des2&#061;sift.detectAndCompute(model,None)<br \/>\n    flann&#061;cv2.FlannBasedMatcher()<br \/>\n    matches&#061;flann.knnMatch(des1,des2,k&#061;2)<br \/>\n    ok&#061;[]<br \/>\n    good_matches&#061;[]<br \/>\n    src_matches&#061;[]<br \/>\n    model_matches&#061;[]<br \/>\n    for m,n in matches:<br \/>\n        if m.distance&lt;0.4*n.distance:<br \/>\n            ok.append((m,n))<br \/>\n            good_matches.append(m)<br \/>\n            src_matches.append(kp1[m.queryIdx].pt)<br \/>\n            model_matches.append(kp2[m.trainIdx].pt)<br \/>\n    num&#061;len(ok)<br \/>\n    if num &gt;&#061;50:<br \/>\n        result&#061;&#039;\u8ba4\u8bc1\u901a\u8fc7&#039;<br \/>\n    else:<br \/>\n        result&#061;&#039;\u8ba4\u8bc1\u5931\u8d25&#039;<br \/>\n    if show_matchs and len(src_matches)&gt;0:<br \/>\n        src_with_matches&#061;src.copy()<br \/>\n        model_with_matches&#061;model.copy()<br \/>\n        for (x,y) in src_matches[:100]:<br \/>\n            cv2.circle(src_with_matches,(int(x),int(y)),3,(0,0,255),-1)<br \/>\n        for (x,y) in model_matches[:100]:<br \/>\n            cv2.circle(model_with_matches,(int(x),int(y)),3,(0,0,255),-1)<br \/>\n        cv2.imshow(&#039;src_matches&#039;,src_with_matches)<br \/>\n        cv2.imshow(&#039;model_matches&#039;,model_with_matches)<br \/>\n        cv2.waitKey(0)<br \/>\n        match_img&#061;cv2.drawMatches(src,kp1,model,kp2,good_matches[:100],None,flags&#061;cv2.DrawMatchesFlags_NOT_DRAW_SINGLE_POINTS)<br \/>\n        cv2.imshow(&#039;pipei&#039;,match_img)<br \/>\n        cv2.waitKey(0)#1<br \/>\n    return  result,num,src_matches,model_matches<\/p>\n<p>if __name__&#061;&#061;&#039;__main__&#039;:<br \/>\n    src1&#061;cv2.imread(&#039;zhiwen1.bmp&#039;)<br \/>\n    src2&#061;cv2.imread(&#039;zhiwen2.bmp&#039;)<br \/>\n    model &#061; cv2.imread(&#039;zhiwen_model.bmp&#039;)<br \/>\n    cv2.imshow(&#039;src1&#039;,src1)<br \/>\n    cv2.imshow(&#039;src2&#039;,src2)<br \/>\n    cv2.imshow(&#039;model&#039;,model)<br \/>\n    cv2.waitKey(0)<br \/>\n    reselt1,num1,src1_matches,model1_matches&#061;verification(src1,model,show_matchs&#061;True)<br \/>\n    reselt2,num2,src2_matches,model2_matches&#061;verification(src2,model,show_matchs&#061;True)<br \/>\n    print(&#039;src1\u7684\u7ed3\u679c\u4e3a&#xff1a;&#039;,reselt1,&#039;\u5339\u914d\u70b9\u6570&#xff1a;{}&#039;.format(num1))<br \/>\n    print(&#039;src2\u7684\u7ed3\u679c\u4e3a&#xff1a;&#039;,reselt2,&#039;\u5339\u914d\u70b9\u6570&#xff1a;{}&#039;.format(num2))<\/p>\n<p>2.\u6307\u7eb9\u8bc6\u522b\u5e76\u8f93\u51fa\u5bf9\u5e94\u4eba\u540d<\/p>\n<p>\u8fd9\u6bb5\u548c\u4e4b\u524d\u6307\u7eb9\u8bc6\u522b\u7684\u662f\u4e00\u6837\u7684<\/p>\n<p>import os<br \/>\nimport cv2<\/p>\n<p># \u8ba1\u7b97\u4e24\u4e2a\u6307\u7eb9\u95f4\u5339\u914d\u70b9\u7684\u4e2a\u6570<br \/>\ndef getNum(src, model):<br \/>\n    img1 &#061; cv2.imread(src)<br \/>\n    img2 &#061; cv2.imread(model)<br \/>\n    sift &#061; cv2.SIFT_create()  # orb_create()<br \/>\n    kp1, des1 &#061; sift.detectAndCompute(img1, None)<br \/>\n    kp2, des2 &#061; sift.detectAndCompute(img2, None)<br \/>\n    flann &#061; cv2.FlannBasedMatcher()<br \/>\n    matches &#061; flann.knnMatch(des1, des2, k&#061;2)<br \/>\n    ok &#061; []<br \/>\n    for m, n in matches:<br \/>\n        if m.distance &lt; 0.8 * n.distance:<br \/>\n            ok.append(m)<br \/>\n    num &#061; len(ok)<br \/>\n    return num<\/p>\n<p>\u5982\u679c\u8981\u5bf9\u5e94\u4e0a\u4eba\u7684\u59d3\u540d\u8fd9\u91cc\u6211\u4eec\u65b0\u589e\u4e24\u4e2a\u51fd\u6570&#xff0c;\u4e00\u662f\u5728\u8fd9\u8fd9\u4e2a\u51fd\u6570\u91cc\u9762\u8fdb\u884c\u6307\u7eb9\u5339\u914d&#xff0c;\u83b7\u53d6\u5339\u914d\u6210\u529f\u8fd9\u4e2a\u6307\u7eb9\u56fe\u7247\u7684\u7f16\u53f7&#xff0c;\u4e8c\u662f\u521b\u5efa\u5b57\u5178\u6bcf\u4e2a\u7f16\u53f7\u5bf9\u5e94\u4e00\u4e2a\u4eba<\/p>\n<p># \u83b7\u53d6\u6307\u7eb9\u7f16\u53f7<br \/>\ndef getID(src, database):<br \/>\n    max &#061; 0<br \/>\n    for file in os.listdir(database):<br \/>\n        model &#061; os.path.join(database, file)<br \/>\n        num &#061; getNum(src, model)<br \/>\n        print(&#034;\u6587\u4ef6\u540d:&#034;, file, &#034;\u5339\u914d\u70b9\u4e2a\u6570:&#034;, num)<br \/>\n        if num &gt; max:<br \/>\n            max &#061; num<br \/>\n            name &#061; file<br \/>\n            ID &#061; name[0]<br \/>\n    if max &lt; 200:  # src\u56fe\u7247\u4e0d\u4e00\u5b9a\u662f\u5e93\u91cc\u9762\u4eba\u7684\u6307\u7eb9<br \/>\n        ID &#061; 9999<br \/>\n    return ID<\/p>\n<p># \u6839\u636e\u6307\u7eb9\u7f16\u53f7&#xff0c;\u83b7\u53d6\u5bf9\u5e94\u59d3\u540d<br \/>\ndef getName(ID):<br \/>\n    nameID &#061; {0: &#039;\u5f20\u4e09&#039;, 1: &#039;\u674e\u56db&#039;, 2: &#039;\u738b\u4e94&#039;, 3: &#039;\u8d75\u516d&#039;, 4: &#039;\u6731\u8001\u4e03&#039;, 5: &#039;\u94b1\u516b&#039;, 6: &#039;\u66f9\u4e5d&#039;, 7: &#039;\u738b\u4e8c\u9ebb\u5b50&#039;, 8: &#039;andy&#039;, 9: &#039;Anna&#039;, 9999: &#039;\u6ca1\u627e\u5230&#039;}<br \/>\n    name &#061; nameID.get(int(ID))<br \/>\n    return name<\/p>\n<p>\u6307\u7eb9\u8bc6\u522b&#xff0c;\u548c\u54ea\u4e2a\u7f16\u53f7\u7684\u6307\u7eb9\u5bf9\u5e94\u4e0a\u5c31\u8c03\u7528\u51fd\u6570\u5bf9\u5e94\u7684\u4e2a\u4eba\u540d\u5b57\u3002<\/p>\n<p># \u4e3b\u51fd\u6570<br \/>\nif __name__ &#061;&#061; &#034;__main__&#034;:<br \/>\n    src &#061; &#034;src.bmp&#034;<br \/>\n    database &#061; &#034;database&#034;<br \/>\n    ID &#061; getID(src, database)<br \/>\n    name &#061; getName(ID)<br \/>\n    print(&#034;\u8bc6\u522b\u7ed3\u679c\u4e3a:&#034;, name)<\/p>\n<p>\u4e8c\u3001\u56fe\u7247\u62fc\u63a5<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"265\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260125002431-697562bf779da.png\" width=\"284\" \/><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"263\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260125002431-697562bf9188c.png\" width=\"280\" \/><\/p>\n<p>\u76ee\u7684\u8ba9\u8fd9\u4e24\u5f20\u56fe\u65e0\u7f1d\u8854\u63a5\u6210\u4e00\u5f20\u56fe\u7247<\/p>\n<p>\u505a\u51c6\u5907&#xff1a;<\/p>\n<p>import cv2<br \/>\nimport numpy as np<br \/>\nimport sys<\/p>\n<p>def cv_show(name, img):<br \/>\n    cv2.imshow(name, img)<br \/>\n    cv2.waitKey(0)<\/p>\n<p>def detectAndDescribe(image):<br \/>\n    gray &#061; cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)  # \u5c06\u5f69\u8272\u56fe\u7247\u8f6c\u6362\u6210\u7070\u5ea6\u56fe<br \/>\n    sift &#061; cv2.SIFT_create()  # \u5efa\u7acbSIFT\u751f\u6210\u5668<br \/>\n    # \u68c0\u6d4bSIFT\u7279\u5f81\u70b9&#xff0c;\u5e76\u8ba1\u7b97\u63cf\u8ff0\u7b26&#xff0c;\u7b2c\u4e8c\u4e2a\u53c2\u6570\u4e3a\u63a9\u819c<br \/>\n    (kps, des) &#061; sift.detectAndCompute(gray, None)<br \/>\n    # \u5c06\u7ed3\u679c\u8f6c\u6362\u6210NumPy\u6570\u7ec4<br \/>\n    kps_float &#061; np.float32([kpc.pt for kpc in kps])<br \/>\n    # kpc \u5305\u542b\u4e24\u4e2a\u503c&#xff0c;\u5206\u522b\u662f\u5173\u952e\u70b9\u5728\u56fe\u50cf\u4e2d\u7684 x \u548c y \u5750\u6807\u3002\u8fd9\u4e9b\u5750\u6807\u901a\u5e38\u662f\u6d6e\u70b9\u6570&#xff0c;\u53ef\u4ee5\u7cbe\u786e\u5730\u63cf\u8ff0\u5173\u952e\u70b9\u5728\u56fe\u50cf\u4e2d\u7684\u4f4d\u7f6e\u3002<br \/>\n    return (kps, kps_float, des)  # \u8fd4\u56de\u7279\u5f81\u70b9\u96c6&#xff0c;\u53ca\u5bf9\u5e94\u7684\u63cf\u8ff0\u7279\u5f81<\/p>\n<p>&#039;&#039;&#039;\u8bfb\u53d6\u62fc\u63a5\u56fe\u7247&#039;&#039;&#039;<br \/>\nimageA &#061; cv2.imread(&#034;zuo.jpg&#034;)<br \/>\ncv_show(&#039;imageA&#039;, imageA)<br \/>\nimageB &#061; cv2.imread(&#034;you.jpg&#034;)<br \/>\ncv_show(&#039;imageB&#039;, imageB)<\/p>\n<p>&#039;&#039;&#039;\u8ba1\u7b97\u56fe\u7247\u7279\u5f81\u70b9\u53ca\u63cf\u8ff0\u7b26&#039;&#039;&#039;<br \/>\n(kpsA, kps_floatA, desA) &#061; detectAndDescribe(imageA)<br \/>\n(kpsB, kps_floatB, desB) &#061; detectAndDescribe(imageB)<\/p>\n<p>&#039;&#039;&#039;\u5efa\u7acb\u5339\u914d\u5668BFMatcher&#xff0c;\u5728\u5339\u914d\u5927\u56fe\u8bad\u7ec3\u96c6\u5408\u65f6\u4f7f\u7528FlannBasedMatcher\u901f\u5ea6\u66f4\u5feb\u3002&#039;&#039;&#039;<br \/>\nmatcher &#061; cv2.BFMatcher()<br \/>\nrawMatches &#061; matcher.knnMatch(desB, desA, k&#061;2)<br \/>\ngood &#061; []<br \/>\nmatches &#061; []<br \/>\nfor m in rawMatches:<br \/>\n    # \u5f53\u6700\u8fd1\u8ddd\u79bb\u8ddf\u6b21\u8fd1\u8ddd\u79bb\u7684\u6bd4\u503c\u5c0f\u4e8e0.65\u65f6&#xff0c;\u4fdd\u7559\u6b64\u5339\u914d\u5bf9<br \/>\n    if len(m) &#061;&#061; 2 and m[0].distance &lt; 0.65 * m[1].distance:<br \/>\n        good.append(m)<br \/>\n        # \u5b58\u50a8\u4e24\u4e2a\u70b9\u5728featuresA\u3001featuresB\u4e2d\u7684\u7d22\u5f15\u503c<br \/>\n        matches.append((m[0].queryIdx, m[0].trainIdx))<br \/>\nprint(len(good))<br \/>\nprint(matches)<br \/>\nvis &#061; cv2.drawMatchesKnn(imageB, kpsB, imageA, kpsA, good, outImg&#061;None, flags&#061;cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)<br \/>\ncv_show(&#034;Keypoint Matches&#034;, vis)<\/p>\n<p>\u8ba1\u7b97\u900f\u89c6\u53d8\u6362\u77e9\u9635<br \/>\nfindHomography(srcPoints, dstPoints, method&#061;None, ransacReprojThreshold&#061;None, mask&#061;None, maxIters&#061;None, confidence&#061;None)<\/p>\n<ul>\n<li>\u00a0\u8ba1\u7b97\u89c6\u89d2\u53d8\u6362\u77e9\u9635&#xff0c;\u900f\u89c6\u53d8\u6362\u51fd\u6570&#xff0c;\u4e0ecv2.getPerspectiveTransform()\u7684\u533a\u522b\u5728\u4e8e\u53ef\u591a\u4e2a\u6570\u636e\u70b9\u53d8\u6362<\/li>\n<li>\u53c2\u6570srcPoints&#xff1a;\u56fe\u7247A\u7684\u5339\u914d\u70b9\u5750\u6807<\/li>\n<li>\u53c2\u6570dstPoints&#xff1a;\u56fe\u7247B\u7684\u5339\u914d\u70b9\u5750\u6807<\/li>\n<li>\u53c2\u6570method&#xff1a;\u8ba1\u7b97\u53d8\u6362\u77e9\u9635\u7684\u65b9\u6cd5\u3002<\/li>\n<li>\u00a0ransacReprojThreshold: \u6700\u5927\u5141\u8bb8\u91cd\u6295\u5f71\u9519\u8bef\u9608\u503c\u3002\u8be5\u53c2\u6570\u53ea\u6709\u5728method\u53c2\u6570\u4e3aRANSAC\u4e0eRHO\u7684\u65f6\u542f\u7528&#xff0c;\u9ed8\u8ba4\u4e3a3<\/li>\n<\/ul>\n<p>findHomography\u7684\u56db\u79cd\u65b9\u6cd5&#xff1a;<\/p>\n<ul>\n<li>H &#061; cv2.findHomography(ptsA, ptsB, 0)&#xff0c;0 &#8211; \u4f7f\u7528\u6240\u6709\u5339\u914d\u70b9\u8ba1\u7b97\u53d8\u6362\u77e9\u9635&#xff0c;\u6700\u5c0f\u4e8c\u4e58\u3002<\/li>\n<li>H &#061; cv2.findHomography(ptsA, ptsB, cv2.RANSAC, 5.0)&#xff0c;RANSAC &#8211; \u968f\u673a\u91c7\u6837\u5c11\u91cf\u70b9\u8ba1\u7b97\u6a21\u578b&#xff0c;\u6d4b\u8bd5\u5176\u4ed6\u70b9\u662f\u5426\u7b26\u5408\u3002<\/li>\n<li>H &#061; cv2.findHomography(ptsA, ptsB, cv2.LMEDS)&#xff0c;\u00a0LMEDS &#8211; \u6700\u5c0f\u5316\u8bef\u5dee\u7684\u4e2d\u4f4d\u6570&#xff0c;\u800c\u4e0d\u662f\u5e73\u5747\u503c<\/li>\n<li>H &#061; cv2.findHomography(ptsA, ptsB, cv2.RHO)&#xff0c;\u00a0RHO &#8211; RANSAC\u7684\u6539\u8fdb\u7248&#xff0c;\u4f7f\u7528\u66f4\u667a\u80fd\u7684\u91c7\u6837\u7b56\u7565<\/li>\n<\/ul>\n<p>findHomography\u8fd4\u56de\u503c\u89e3\u91ca&#xff1a;<\/p>\n<ul>\n<li>\u8fd4\u56de\u503c&#xff1a;\u4e2d\u503c\u4e3a\u53d8\u6362\u77e9\u9635&#xff0c;mask\u662f\u63a9\u6a21\u6807\u5fd7&#xff0c;\u6307\u793a\u54ea\u4e9b\u70b9\u5bf9\u5e94\u5185\u70b9&#xff0c;\u54ea\u4e9b\u662f\u5916\u70b9\u3002<\/li>\n<li>\u5185\u70b9&#xff1a;\u6307\u90a3\u4e9b\u4e0e\u4f30\u8ba1\u7684\u6a21\u578b\u975e\u5e38\u63a5\u8fd1\u7684\u6570\u636e\u70b9&#xff0c;\u901a\u5e38\u662f\u6b63\u786e\u5339\u914d\u6216\u771f\u5b9e\u6570\u636e\u3002<\/li>\n<li>\u5916\u70b9&#xff1a;\u6307\u90a3\u4e9b\u4e0e\u4f30\u8ba1\u7684\u6a21\u578b\u4e0d\u63a5\u8fd1\u7684\u6570\u636e\u70b9&#xff0c;\u901a\u5e38\u662f\u9519\u8bef\u5339\u914d\u6216\u566a\u58f0\u6570\u636e\u3002<\/li>\n<\/ul>\n<p>&#039;&#039;&#039;\u900f\u89c6\u53d8\u6362&#039;&#039;&#039;<br \/>\nif len(matches) &gt; 4:  # \u5f53\u7b5b\u9009\u540e\u7684\u5339\u914d\u5bf9\u5927\u4e8e4\u65f6&#xff0c;\u8ba1\u7b97\u89c6\u89d2\u53d8\u6362\u77e9\u9635\u3002<br \/>\n    # \u83b7\u53d6\u5339\u914d\u5bf9\u7684\u70b9\u5750\u6807<br \/>\n    ptsB &#061; np.float32([kps_floatB[i] for (i, _) in matches])  # matches\u662f\u901a\u8fc7\u9608\u503c\u7b5b\u9009\u4e4b\u540e\u7684\u7279\u5f81\u70b9\u5bf9\u8c61<br \/>\n    ptsA &#061; np.float32([kps_floatA[i] for (_, i) in matches])  # kps_floatA\u662f\u56fe\u7247A\u4e2d\u7684\u5168\u90e8\u7279\u5f81\u70b9\u5750\u6807<br \/>\n    H, mask &#061; cv2.findHomography(ptsB, ptsA, cv2.RANSAC, 10)<br \/>\nelse:<br \/>\n    print(&#039;\u56fe\u7247\u672a\u627e\u52304\u4e2a\u4ee5\u4e0a\u7684\u5339\u914d\u70b9&#039;)<br \/>\n    sys.exit()<\/p>\n<p>result &#061; cv2.warpPerspective(imageB, H, (imageB.shape[1] &#043; imageA.shape[1], imageB.shape[0]))<br \/>\ncv_show(&#039;resultB&#039;, result)<br \/>\n# \u5c06\u56fe\u7247A\u4f20\u5165resultB\u540e\u663e\u793a<br \/>\nresult[0:imageA.shape[0], 0:imageA.shape[1]] &#061; imageA<br \/>\ncv_show(&#039;result&#039;, result)<br \/>\ncv2.imwrite(&#039;pingjie.jpg&#039;, result)<\/p>\n<p>\u5c55\u793azuo\u548cyou&#xff0c;\u5e76\u5bf9\u5339\u914d\u4e0a\u7684\u7279\u5f81\u8fdb\u884c\u8fde\u7ebf&#xff0c;\u8fd9\u70b9\u548c\u6307\u7eb9\u8bc6\u522b\u662f\u4e00\u6837\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1213\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260125002431-697562bfa65c8.png\" width=\"1498\" \/><\/p>\n<p>\u5c55\u793ayou\u56fe\u7ecf\u8fc7\u900f\u89c6\u4e4b\u540e\u7684\u53d8\u5316\u4ee5\u53ca\u6700\u540e\u62fc\u63a5\u6210\u529f\u7684\u7ed3\u679c\u3002\u6211\u4eec\u80fd\u770b\u51fa\u8fd8\u662f\u6709\u62fc\u63a5\u75d5\u8ff9\u7684&#xff0c;\u5c31\u6bd4\u5982\u7eb8\u7bb1\u5904\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1207\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260125002432-697562c0a3927.png\" width=\"1492\" \/><\/p>\n<p>\u4e09\u3001\u601d\u8003<\/p>\n<p>\u4e0a\u9762\u6211\u4eec\u56fe\u50cf\u62fc\u63a5\u662f\u5bf9b\u56fe\u8fdb\u884c\u900f\u89c6\u8f6c\u5316&#xff0c;\u628a\u900f\u89c6\u7684b\u56fe\u62fc\u63a5\u5728a\u56fe\u7684\u53f3\u4fa7&#xff0c;\u601d\u8003\u6211\u4eec\u80fd\u4e0d\u80fd\u5bf9\u56fea\u8fdb\u884c\u900f\u89c6&#xff0c;\u628aa\u56fe\u62fc\u63a5\u5728b\u56fe\u7684\u5de6\u4fa7\u3002\u5f97\u5230\u4e0b\u9762\u8fd9\u79cd\u7ed3\u679c\u7684\u62fc\u63a5\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"600\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260125002433-697562c1b7c79.png\" width=\"1499\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u6307\u7eb9\u8bc6\u522b1.\u4e0a\u7bc7\u535a\u5ba2\u4e2d\u8bb2\u5230\u6307\u7eb9\u8bc6\u522b\u4ee5\u53ca\u5bf9\u5339\u914d\u4e0a\u7684\u70b9\u6807\u51fa&#xff0c;\u8fd9\u6b21\u6211\u4eec\u5b9e\u73b0\u8ba9\u5339\u914d\u5bf9\u5e94\u7684\u70b9\u8fde\u63a5\u8d77\u6765&#xff0c;\u4ece\u8fde\u63a5\u7684\u7ebf\u4e0a\u53cd\u5e94\u5339\u914d\u7684\u7a0b\u5ea6\u8fd9\u91cc\u548c\u4e0a\u7bc7\u535a\u5ba2\u4e2d\u4ee3\u7801\u4e00\u6837&#xff0c;\u53ea\u4e0d\u8fc7\u5728\u51fd\u6570\u4e2d\u7a0d\u6539\u52a8\u4e86&#xff0c;\u6dfb\u52a0\u4e86src_matches[]\u8fd9\u4e2a\u53d8\u91cf&#xff0c;\u4ee5\u53ca\u540e\u9762\u5bf9\u5176\u7684\u4f7f\u7528import cv2<br \/>\ndef cv_show(name,img):cv2.imshow(name,img)cv2.waitKey(0)<br \/>\ndef verification(src,<\/p>\n","protected":false},"author":2,"featured_media":65531,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[1460,50,523],"topic":[],"class_list":["post-65536","post","type-post","status-publish","format-standard","has-post-thumbnail","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>\u8ba1\u7b97\u673a\u89c6\u89c9opencv\u4e4b\u6307\u7eb9\u8bc6\u522b\u8865\u5145&amp;\u56fe\u7247\u62fc\u63a5&amp;\u601d\u8003 - \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\/65536.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u8ba1\u7b97\u673a\u89c6\u89c9opencv\u4e4b\u6307\u7eb9\u8bc6\u522b\u8865\u5145&amp;\u56fe\u7247\u62fc\u63a5&amp;\u601d\u8003 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u4e00\u3001\u6307\u7eb9\u8bc6\u522b1.\u4e0a\u7bc7\u535a\u5ba2\u4e2d\u8bb2\u5230\u6307\u7eb9\u8bc6\u522b\u4ee5\u53ca\u5bf9\u5339\u914d\u4e0a\u7684\u70b9\u6807\u51fa&#xff0c;\u8fd9\u6b21\u6211\u4eec\u5b9e\u73b0\u8ba9\u5339\u914d\u5bf9\u5e94\u7684\u70b9\u8fde\u63a5\u8d77\u6765&#xff0c;\u4ece\u8fde\u63a5\u7684\u7ebf\u4e0a\u53cd\u5e94\u5339\u914d\u7684\u7a0b\u5ea6\u8fd9\u91cc\u548c\u4e0a\u7bc7\u535a\u5ba2\u4e2d\u4ee3\u7801\u4e00\u6837&#xff0c;\u53ea\u4e0d\u8fc7\u5728\u51fd\u6570\u4e2d\u7a0d\u6539\u52a8\u4e86&#xff0c;\u6dfb\u52a0\u4e86src_matches[]\u8fd9\u4e2a\u53d8\u91cf&#xff0c;\u4ee5\u53ca\u540e\u9762\u5bf9\u5176\u7684\u4f7f\u7528import cv2 def cv_show(name,img):cv2.imshow(name,img)cv2.waitKey(0) def verification(src,\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/65536.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-01-25T00:24:35+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260125002431-697562bf779da.png\" \/>\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=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/65536.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/65536.html\",\"name\":\"\u8ba1\u7b97\u673a\u89c6\u89c9opencv\u4e4b\u6307\u7eb9\u8bc6\u522b\u8865\u5145&amp;\u56fe\u7247\u62fc\u63a5&amp;\u601d\u8003 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-01-25T00:24:35+00:00\",\"dateModified\":\"2026-01-25T00:24:35+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/65536.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/65536.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/65536.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u8ba1\u7b97\u673a\u89c6\u89c9opencv\u4e4b\u6307\u7eb9\u8bc6\u522b\u8865\u5145&amp;\u56fe\u7247\u62fc\u63a5&amp;\u601d\u8003\"}]},{\"@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":"\u8ba1\u7b97\u673a\u89c6\u89c9opencv\u4e4b\u6307\u7eb9\u8bc6\u522b\u8865\u5145&amp;\u56fe\u7247\u62fc\u63a5&amp;\u601d\u8003 - \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\/65536.html","og_locale":"zh_CN","og_type":"article","og_title":"\u8ba1\u7b97\u673a\u89c6\u89c9opencv\u4e4b\u6307\u7eb9\u8bc6\u522b\u8865\u5145&amp;\u56fe\u7247\u62fc\u63a5&amp;\u601d\u8003 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u4e00\u3001\u6307\u7eb9\u8bc6\u522b1.\u4e0a\u7bc7\u535a\u5ba2\u4e2d\u8bb2\u5230\u6307\u7eb9\u8bc6\u522b\u4ee5\u53ca\u5bf9\u5339\u914d\u4e0a\u7684\u70b9\u6807\u51fa&#xff0c;\u8fd9\u6b21\u6211\u4eec\u5b9e\u73b0\u8ba9\u5339\u914d\u5bf9\u5e94\u7684\u70b9\u8fde\u63a5\u8d77\u6765&#xff0c;\u4ece\u8fde\u63a5\u7684\u7ebf\u4e0a\u53cd\u5e94\u5339\u914d\u7684\u7a0b\u5ea6\u8fd9\u91cc\u548c\u4e0a\u7bc7\u535a\u5ba2\u4e2d\u4ee3\u7801\u4e00\u6837&#xff0c;\u53ea\u4e0d\u8fc7\u5728\u51fd\u6570\u4e2d\u7a0d\u6539\u52a8\u4e86&#xff0c;\u6dfb\u52a0\u4e86src_matches[]\u8fd9\u4e2a\u53d8\u91cf&#xff0c;\u4ee5\u53ca\u540e\u9762\u5bf9\u5176\u7684\u4f7f\u7528import cv2 def cv_show(name,img):cv2.imshow(name,img)cv2.waitKey(0) def verification(src,","og_url":"https:\/\/www.wsisp.com\/helps\/65536.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-01-25T00:24:35+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260125002431-697562bf779da.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/65536.html","url":"https:\/\/www.wsisp.com\/helps\/65536.html","name":"\u8ba1\u7b97\u673a\u89c6\u89c9opencv\u4e4b\u6307\u7eb9\u8bc6\u522b\u8865\u5145&amp;\u56fe\u7247\u62fc\u63a5&amp;\u601d\u8003 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-01-25T00:24:35+00:00","dateModified":"2026-01-25T00:24:35+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/65536.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/65536.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/65536.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u8ba1\u7b97\u673a\u89c6\u89c9opencv\u4e4b\u6307\u7eb9\u8bc6\u522b\u8865\u5145&amp;\u56fe\u7247\u62fc\u63a5&amp;\u601d\u8003"}]},{"@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\/65536","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=65536"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/65536\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/65531"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=65536"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=65536"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=65536"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=65536"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}