{"id":64610,"date":"2026-01-23T20:33:02","date_gmt":"2026-01-23T12:33:02","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/64610.html"},"modified":"2026-01-23T20:33:02","modified_gmt":"2026-01-23T12:33:02","slug":"%e8%ae%a1%e7%ae%97%e6%9c%ba%e8%a7%86%e8%a7%89opencv%e4%b9%8b%e9%87%91%e5%ad%97%e5%a1%94%e7%9b%b4%e6%96%b9%e5%9b%be","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/64610.html","title":{"rendered":"\u8ba1\u7b97\u673a\u89c6\u89c9opencv\u4e4b\u91d1\u5b57\u5854&amp;\u76f4\u65b9\u56fe"},"content":{"rendered":"<p>\u4e00\u3001\u91d1\u5b57\u5854<\/p>\n<p>&#xff08;\u4e00&#xff09;\u9ad8\u65af\u91d1\u5b57\u5854<\/p>\n<p>\u9ad8\u65af\u91d1\u5b57\u5854\u662f\u4e00\u79cd\u56fe\u50cf\u591a\u5c3a\u5ea6\u8868\u793a\u65b9\u6cd5&#xff0c;\u7528\u4e8e\u56fe\u50cf\u5904\u7406\u4e2d\u7684\u5c3a\u5bf8\u7f29\u653e\u548c\u591a\u5206\u8fa8\u7387\u5206\u6790\u3002<\/p>\n<p>1.\u9ad8\u65af\u91d1\u5b57\u5854\u64cd\u4f5c\u4e2d\u7684\u4e0b\u91c7\u6837<\/p>\n<p>\u4e0b\u91c7\u6837\u662f\u4e00\u79cd\u51cf\u5c0f\u56fe\u50cf\u5c3a\u5bf8\u7684\u65b9\u6cd5&#xff0c;\u5b83\u901a\u5e38\u6d89\u53ca\u5230\u964d\u4f4e\u56fe\u50cf\u7684\u5206\u8fa8\u7387&#xff0c;\u5373\u51cf\u5c11\u56fe\u50cf\u4e2d\u50cf\u7d20\u7684\u6570\u91cf&#xff0c;\u4ece\u800c\u4f7f\u56fe\u50cf\u770b\u8d77\u6765\u66f4\u5c0f<\/p>\n<p>import cv2<br \/>\nimage&#061;cv2.imread(r&#034;D:\\\\project\\\\123s.jpg&#034;,0)<br \/>\ncv2.imshow(&#039;image1&#039;,image)<\/p>\n<p>image_down1&#061;cv2.pyrDown(image)<br \/>\ncv2.imshow(&#039;down1&#039;,image_down1)<\/p>\n<p>image_down2&#061;cv2.pyrDown(image_down1)<br \/>\ncv2.imshow(&#039;down2&#039;,image_down2)<\/p>\n<p>cv2.waitKey(0)<\/p>\n<p>\u5bf9\u539f\u56fe\u8fdb\u884c\u7f29\u5c0f&#xff0c;\u5220\u9664\u50cf\u7d20\u77e9\u9635\u7684\u5076\u6570\u884c\u548c\u5217&#xff0c;\u56fe\u7247\u53d8\u6a21\u7cca<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"935\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260123123253-69736a75d39ac.png\" width=\"1011\" \/><\/p>\n<p>2.\u9ad8\u65af\u91d1\u5b57\u5854\u64cd\u4f5c\u4e2d\u7684\u4e0a\u91c7\u6837<\/p>\n<p>\u4e0a\u91c7\u6837\u662f\u4e00\u79cd\u589e\u5927\u56fe\u50cf\u5c3a\u5bf8\u7684\u65b9\u6cd5&#xff0c;\u4ed6\u901a\u8fc7\u63d2\u503c\u548c\u6ee4\u6ce2\u6280\u672f\u6765\u6062\u590d\u56fe\u50cf\u7684\u5206\u8fa8\u7387\u548c\u7ec6\u8282&#xff0c;\u901a\u5e38\u7528\u610f\u56fe\u50cf\u653e\u5927\u6216\u4e0e\u4e0b\u91c7\u6837\u540e\u7684\u56fe\u50cf\u8fdb\u884c\u6bd4\u8f83&#xff08;\u8fd9\u91cc\u6211\u4eec\u63a5\u7740\u4e0b\u91c7\u6837\u4ee3\u7801\u540e\u9762\u5199&#xff09;<\/p>\n<p>image_up1&#061;cv2.pyrUp(image)<br \/>\ncv2.imshow(&#039;up1&#039;,image_up1)<\/p>\n<p>image_up2&#061;cv2.pyrUp(image_up1)<br \/>\ncv2.imshow(&#039;up1&#039;,image_up2)<br \/>\ncv2.waitKey(0)<\/p>\n<p>\u56fe\u7247\u4f1a\u53d8\u5f97\u5f88\u5927&#xff0c;\u7531\u4e8e\u592a\u5927&#xff0c;\u4e0d\u597d\u5c55\u793a&#xff0c;\u4e0a\u91c7\u6837\u662f\u63d2\u5165\u96f6\u884c\u6216\u5217<\/p>\n<p>3.\u5bf9\u4e0b\u91c7\u6837\u540e\u56fe\u50cf\u8fdb\u884c\u4e0a\u91c7\u6837<\/p>\n<p>&#039;&#039;&#039;\u5bf9\u4e0b\u91c7\u6837\u540e\u56fe\u50cf\u8fdb\u884c\u4e0a\u91c7\u6837&#xff0c;\u56fe\u50cf\u53d8\u6a21\u7cca&#xff0c;\u65e0\u6cd5\u590d\u539f&#039;&#039;&#039;<br \/>\nimage_down1_up&#061;cv2.pyrUp(image_down1)<br \/>\nimage_down2_up&#061;cv2.pyrUp(image_down2)<\/p>\n<p>cv2.imshow(&#039;down1_up&#039;,image_down1_up)<br \/>\ncv2.imshow(&#039;down2_up&#039;,image_down2_up)<br \/>\ncv2.waitKey(0)<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"947\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260123123254-69736a764937b.png\" width=\"1039\" \/><\/p>\n<p>&#xff08;\u4e8c&#xff09;\u62c9\u666e\u62c9\u65af\u91d1\u5b57\u5854<\/p>\n<p>\u62c9\u666e\u62c9\u65af\u91d1\u5b57\u5854\u662f\u9ad8\u65af\u91d1\u5b57\u5854\u7684\u201c\u7ec6\u8282\u8865\u5145\u201d\u7248\u672c&#xff0c;\u7528\u4e8e\u4fdd\u5b58\u548c\u6062\u590d\u56fe\u50cf\u9ad8\u9891\u7ec6\u8282\u3002<\/p>\n<p>\u62c9\u666e\u62c9\u65af &#061; \u539f\u56fe &#8211; \u4e0a\u91c7\u6837\u7684\u6a21\u7cca\u56fe<\/p>\n<p>\u8fd9\u91cc\u6211\u4eec\u5728L0\u548cL1\u4e4b\u95f4\u52a0\u5165\u7684\u4f7f\u7528resize\u662f\u8ba9down2\u2014\u2014up\u56fe\u7247\u5c3a\u5bf8\u548cdown1\u56fe\u7247\u5c3a\u5bf8\u4fdd\u6301\u4e00\u81f4&#xff0c;\u8fd9\u6837\u624d\u53ef\u4ee5\u8fdb\u884c\u76f8\u51cf&#xff0c;\u4e0d\u8fdb\u884c\u5c3a\u5bf8\u4e00\u81f4&#xff0c;\u5c31\u4f1a\u62a5\u9519<\/p>\n<p>&#039;&#039;&#039;\u62c9\u666e\u62c9\u65af\u91d1\u5b57\u5854&#039;&#039;&#039;<br \/>\nL0&#061;image-image_down1_up<\/p>\n<p>image_down2_up &#061; cv2.resize(image_down2_up, (image_down1.shape[1], image_down1.shape[0]))<\/p>\n<p>L1&#061;image_down1-image_down2_up<\/p>\n<p>fuyuan&#061;image_down1_up&#043;L0<br \/>\ncv2.imshow(&#039;L0&#039;,L0)<br \/>\ncv2.imshow(&#039;L1&#039;,L1)<br \/>\ncv2.imshow(&#039;fuyuan&#039;,fuyuan)<br \/>\ncv2.waitKey(0)<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1121\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260123123255-69736a772f86a.png\" width=\"1871\" \/><\/p>\n<p>\u4e09\u3001\u76f4\u65b9\u56fe<\/p>\n<p>cv2.calcHist(images,channeLs,mask,histSize,ranges) &#xff1a;\u8ba1\u7b97\u56fe\u50cf\u7684\u76f4\u65b9\u56fe,\u7528\u4e8e\u8868\u793a\u56fe\u50cf\u4e2d\u50cf\u7d20\u7070\u5ea6\u7ea7\u522b\u7684\u5206\u5e03\u60c5\u51b5.<\/p>\n<ul>\n<li>images:\u539f\u56fe\u50cf\u56fe\u50cf\u683c\u5f0f\u4e3auint8\u6216float32\u3002\u5f53\u4f20\u5165\u51fd\u6570\u65f6\u5e94\u7528\u4e2d\u62ec\u53f7[]\u62ec\u6765&#xff0c;\u4f8b\u5982[img]<\/li>\n<li>channels:\u8868\u793a\u4f20\u5165\u7684\u56fe\u50cf\u901a\u9053\u6570\u3002\u5982\u679c\u8f93\u5165\u56fe\u50cf\u662f\u7070\u5ea6\u56fe\u5b83\u7684\u503c\u5c31\u662f[0]\u3002 \u5982\u679c\u662f\u5f69\u8272\u56fe\u50cf\u7684\u4f20\u5165\u7684\u53c2\u6570\u53ef\u4ee5\u662f[0][1][2]\u5b83\u4eec\u5206\u522b\u5bf9\u5e94\u7740BGR\u3002<\/li>\n<li>mask:\u63a9\u6a21\u56fe\u50cf\u3002\u7edf\u8ba1\u6574\u5e45\u56fe\u50cf\u7684\u76f4\u65b9\u56fe\u5c31\u628a\u5b83\u4e3aNone\u3002\u4f46\u662f\u5982\u679c\u4f60\u60f3\u7edf\u8ba1\u56fe\u50cf\u67d0\u4e00\u90e8\u5206\u7684\u76f4\u65b9\u56fe&#xff0c;\u4f60\u5c31\u5236\u4f5c\u4e00\u4e2a\u63a9\u6a21\u56fe\u50cf\u5e76\u4f7f\u7528\u5b83\u3002<\/li>\n<li>histSize:BINS\u7684\u6570\u76ee\u3002\u4e5f\u9700\u7528\u4e2d\u62ec\u53f7\u62ec\u6765(\u5206\u6210\u591a\u5c11\u4e2a\u533a\u95f4)<\/li>\n<li>BINS:\u4e0a\u9762\u7684\u76f4\u65b9\u56fe\u663e\u793a\u4e86\u6bcf\u4e2a\u50cf\u7d20\u503c\u7684\u50cf\u7d20\u6570&#xff0c;\u5373\u4ece0\u5230255\u3002\u5373\u60a8\u9700\u8981256\u4e2a\u503c\u624d\u80fd\u663e\u793a\u4e0a\u8ff0\u76f4\u65b9\u56fe\u3002<\/li>\n<\/ul>\n<p>import cv2<br \/>\nimport numpy as np<br \/>\nimport numpy as pd<br \/>\nimport matplotlib.pyplot as plt<br \/>\nimage&#061;cv2.imread(r&#034;D:\\\\project\\\\cat2s.jpg&#034;)<br \/>\na&#061;image.ravel()#\u5c06\u56fe\u50cf\u8f6c\u6362\u4e3a\u4e00\u7ef4\u6570\u7ec4&#xff0c;numpy\u7684ravel\u51fd\u6570<br \/>\nplt.hist(a,bins&#061;256)#matplotlib\u7684hist\u51fd\u6570\u7ed8\u5236\u76f4\u65b9\u56fe<br \/>\nplt.show()<br \/>\nimage_hist&#061;cv2.calcHist([image],[0],None,[16],[0,256])<br \/>\nplt.plot(image_hist)#\u4f7f\u7528calcHist\u7684\u503c\u7ed8\u5236\u66f2\u7ebf\u56fe<br \/>\nplt.show()<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"282\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260123123256-69736a78650e8.png\" width=\"335\" \/><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"278\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260123123257-69736a7933369.png\" width=\"333\" \/><\/p>\n<p>img&#061;cv2.imread(r&#034;D:\\\\project\\\\cat2s.jpg&#034;)<br \/>\ncolor&#061;(&#039;b&#039;,&#039;g&#039;,&#039;r&#039;)<br \/>\nfor i,col in enumerate(color):<br \/>\n    histr&#061;cv2.calcHist([img],[i],None,[256],[0,256])<br \/>\n    plt.plot(histr,color&#061;col)<br \/>\nplt.show()<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"793\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260123123258-69736a7a0a102.png\" width=\"943\" \/><\/p>\n<p>cv2.bitwise_and():\u5bf9\u56fe\u50cf(\u7070\u5ea6\u56fe\u50cf\u6216\u5f69\u8272\u56fe\u50cf\u5747\u53ef)\u6bcf\u4e2a\u50cf\u7d20\u503c\u8fdb\u884c\u4e8c\u8fdb\u5236&#034;\u4e0e&#034;\u64cd\u4f5c&#xff0c;1&amp;1&#061;1&#xff0c;1&amp;0&#061;0&#xff0c;01&#061;0&#xff0c;0&amp;0&#061;0<\/p>\n<p>bitwise_and(src1, src2, dst&#061;None, mask&#061;None)\u53c2\u6570:<\/p>\n<ul>\n<li>src1\u3001Src2:\u4e3a\u8f93\u5165\u56fe\u50cf\u6216\u6807\u91cf&#xff0c;\u6807src1\u548csrc2\u76f8\u4e0e\u3002<\/li>\n<li>dst:\u53ef\u9009\u8f93\u51fa\u53d8\u91cf&#xff0c;\u5982\u679c\u9700\u8981\u4f7f\u7528\u975eNone\u5219\u8981\u5148\u5b9a\u4e49&#xff0c;\u4e14\u5176\u5927\u5c0f\u4e0e\u8f93\u5165\u53d8\u91cf\u76f8\u540c<\/li>\n<li>mask:\u56fe\u50cf\u63a9\u819c&#xff0c;\u53ef\u9009\u53c2\u6570&#xff0c;\u7528\u4e8e\u6307\u5b9a\u8981\u66f4\u6539\u7684\u8f93\u51fa\u56fe\u50cf\u6570\u7ec4\u7684\u5143\u7d20&#xff0c;mask\u4e3ao\u7684\u503c&#xff0c;src1\u548cIsrc2\u76f8\u4e0e\u7684\u503c\u90fd\u4e3a0\u975e\u7684\u503c&#xff0c;\u4e3asrc1\u548csrc2\u76f8\u4e0e\u7684\u503c\u3002<\/li>\n<\/ul>\n<p>mask&#xff1a;\u76f4\u65b9\u56fe\u63a9\u819c&#xff08;mask&#xff09;\u662f\u4e00\u4e2a\u4e8c\u503c\u56fe\u50cf&#xff0c;\u7528\u4e8e\u6307\u5b9a\u8ba1\u7b97\u76f4\u65b9\u56fe\u7684\u533a\u57df\u3002\u4f5c\u7528&#xff1a;\u53ea\u7edf\u8ba1\u63a9\u819c\u767d\u8272\u533a\u57df(255)\u7684\u50cf\u7d20&#xff0c;\u5ffd\u7565\u9ed1\u8272\u533a\u57df(0)<\/p>\n<p>img2&#061;cv2.imread(r&#034;D:\\\\project\\\\cat2s.jpg&#034;,cv2.IMREAD_GRAYSCALE)<br \/>\ncv2.imshow(&#039;img2&#039;,img2)<br \/>\ncv2.waitKey(0)<br \/>\nmask&#061;np.zeros(img2.shape[:2],np.uint8)<br \/>\nmask[50:600,100:400]&#061;255<br \/>\ncv2.imshow(&#039;mask&#039;,mask)<br \/>\ncv2.waitKey(0)<\/p>\n<p>img2_mask&#061;cv2.bitwise_and(img2,img2,mask&#061;mask)<br \/>\ncv2.imshow(&#039;img_mask&#039;,img2_mask)<br \/>\ncv2.waitKey(0)<br \/>\nimg2_hist_mask&#061;cv2.calcHist([img2],[0],mask,[256],[0,256])<br \/>\nplt.plot(img2_hist_mask)<br \/>\nplt.show()<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"753\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260123123258-69736a7ace093.png\" width=\"1606\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"801\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260123123300-69736a7c3873b.png\" width=\"954\" \/><\/p>\n<p>\u4e09\u3001\u76f4\u65b9\u56fe\u7684\u5747\u8861\u5316<\/p>\n<p>\u771f\u65b9\u56fe\u5747\u8861\u5316:\u771f\u65b9\u56fe\u5747\u8861\u5316\u662f\u4e00\u79cd\u56fe\u50cf\u589e\u5f3a\u6280\u672f&#xff0c;\u5b83\u53ef\u4ee5\u901a\u8fc7\u589e\u52a0\u56fe\u50cf\u7684\u5bf9\u6bd4\u5ea6\u548c\u4eae\u5ea6\u6765\u6539\u5584\u56fe\u50cf\u7684\u8d28\u91cf\u3002<\/p>\n<p>\u76f4\u65b9\u56fe\u5747\u8861\u5316\u901a\u8fc7\u5c06\u56fe\u50cf\u7684\u50cf\u7d20\u503c\u5206\u5e03\u5747\u5300\u5316\u6765\u5b9e\u73b0\u8fd9\u4e00\u76ee\u6807\u3002<\/p>\n<p>\u5728Python OpenCV\u4e2d,\u53ef\u4ee5\u4f7f\u7528cv2.equalizeHist()\u51fd\u6570\u6765\u5b9e\u73b0\u76f4\u65b9\u56fe\u5747\u8861\u5316\u3002 \u8be5\u51fd\u6570\u5c06\u8f93\u5165\u56fe\u50cf\u8f6c\u6362\u4e3a\u7070\u5ea6\u56fe\u50cf&#xff0c;\u5e76\u5c06\u5176\u50cf\u7d20\u503c\u5206\u5e03\u5747\u5300\u5316&#xff0c;\u4ece\u800c\u589e\u5f3a\u56fe\u50cf\u7684\u5bf9\u6bd4\u5ea6\u548c\u4eae\u5ea6\u3002<\/p>\n<p>import matplotlib.pyplot as plt<br \/>\nimport  numpy as np<br \/>\nimport cv2<br \/>\nblack&#061;cv2.imread(&#034;black.jpg&#034;,cv2.IMREAD_GRAYSCALE)<br \/>\nplt.hist(black.ravel(),bins&#061;256)#\u591a\u7ef4\u6570\u7ec4\u62c9\u4e3a\u4e00\u7ef4<br \/>\n# plt.show()<br \/>\nblack_equalize&#061;cv2.equalizeHist(black)<br \/>\nplt.hist(black_equalize.ravel(),bins&#061;256)<br \/>\n# plt.show()<br \/>\nres&#061;np.hstack((black,black_equalize))#\u6a2a\u5411\u62fc\u63a5&#xff0c;\u5c06\u591a\u4e2a\u6570\u7ec4\u6309\u6c34\u5e73\u65b9\u5411&#xff08;\u5217\u987a\u5e8f&#xff09;\u5806\u53e0\u4e00\u4e2a\u65b0\u7684\u6570\u7ec4<br \/>\ncv2.imshow(&#039;black_equalize&#039;,res)<br \/>\ncv2.waitKey(0)<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"589\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260123123300-69736a7c837ca.png\" width=\"861\" \/><\/p>\n<p>\u81ea\u9002\u5e94\u767e\u65b9\u56fe\u5747\u8861\u5316(\u5c40\u90e8\u767e\u65b9\u56fe\u5904\u7406&#xff09;&#xff0c;\u901a\u8fc7\u5c40\u90e8\u8c03\u6574\u56fe\u50cf\u7684\u76f4\u65b9\u56fe\u5206\u5e03\u6765\u63d0\u5347\u56fe\u50cf\u7684\u5bf9\u6bd4\u5ea6\u548c\u7ec6\u8282\u8868\u73b0\u529b&#xff0c;\u5f53\u9700\u8981\u4fdd\u5b58\u7ec6\u8282\u7279\u5f81&#xff0c;\u9700\u8981\u505a\u5c40\u90e8\u5904\u7406<\/p>\n<p>cv2.createCLAHE([, clipLimit[, tileGridSize]])\u2014\u2014&gt;retval \u53c2\u6570\u8bf4\u660e:<\/p>\n<ul>\n<li>clipLimit:\u989c\u8272\u5bf9\u6bd4\u5ea6\u7684\u9608\u503c&#xff0c;\u53ef\u9009\u9879&#xff0c;\u9ed8\u8ba4\u503c8<\/li>\n<li>titleGridSize:\u5c40\u90e8\u76f4\u65b9\u56fe\u5747\u8861\u5316\u7684\u6a21\u677f(\u90bb\u57df)\u5927\u5c0f&#xff0c;\u53ef\u9009\u9879&#xff0c;\u9ed8\u8ba4\u503c(8,8)<\/li>\n<\/ul>\n<p>\u53ef\u4ee5\u8c03\u8282\u53c2\u6570\u7684\u503c\u5f97\u5230\u5904\u7406\u6bd4\u8f83\u597d\u7684\u56fe\u7247<\/p>\n<p>clahe&#061;cv2.createCLAHE(clipLimit&#061;30,tileGridSize&#061;(3,3))#\u901a\u8fc7\u7c7b\u521b\u5efa\u4e86\u4e00\u4e2a\u5c40\u90e8\u5747\u8861\u5316\u5bf9\u8c61<br \/>\nblack_clahe&#061;clahe.apply(black)<br \/>\nres&#061;np.hstack((black,black_equalize,black_clahe))<br \/>\ncv2.imshow(&#039;black_equalize&#039;,res)<br \/>\ncv2.waitKey(0)<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"587\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260123123300-69736a7ce53e0.png\" width=\"1290\" \/><\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u91d1\u5b57\u5854&#xff08;\u4e00&#xff09;\u9ad8\u65af\u91d1\u5b57\u5854\u9ad8\u65af\u91d1\u5b57\u5854\u662f\u4e00\u79cd\u56fe\u50cf\u591a\u5c3a\u5ea6\u8868\u793a\u65b9\u6cd5&#xff0c;\u7528\u4e8e\u56fe\u50cf\u5904\u7406\u4e2d\u7684\u5c3a\u5bf8\u7f29\u653e\u548c\u591a\u5206\u8fa8\u7387\u5206\u6790\u30021.\u9ad8\u65af\u91d1\u5b57\u5854\u64cd\u4f5c\u4e2d\u7684\u4e0b\u91c7\u6837\u4e0b\u91c7\u6837\u662f\u4e00\u79cd\u51cf\u5c0f\u56fe\u50cf\u5c3a\u5bf8\u7684\u65b9\u6cd5&#xff0c;\u5b83\u901a\u5e38\u6d89\u53ca\u5230\u964d\u4f4e\u56fe\u50cf\u7684\u5206\u8fa8\u7387&#xff0c;\u5373\u51cf\u5c11\u56fe\u50cf\u4e2d\u50cf\u7d20\u7684\u6570\u91cf&#xff0c;\u4ece\u800c\u4f7f\u56fe\u50cf\u770b\u8d77\u6765\u66f4\u5c0fimport cv2<br \/>\nimagecv2.imread(r\\&#8221;D:\\\\project\\\\123s.jpg\\&#8221;,0)<br \/>\ncv2.imshow(image1,image)ima<\/p>\n","protected":false},"author":2,"featured_media":64600,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[1460,50,3829,371,523],"topic":[],"class_list":["post-64610","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-opencv","tag-50","tag-3829","tag-371","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\u91d1\u5b57\u5854&amp;\u76f4\u65b9\u56fe - \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\/64610.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\u91d1\u5b57\u5854&amp;\u76f4\u65b9\u56fe - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u4e00\u3001\u91d1\u5b57\u5854&#xff08;\u4e00&#xff09;\u9ad8\u65af\u91d1\u5b57\u5854\u9ad8\u65af\u91d1\u5b57\u5854\u662f\u4e00\u79cd\u56fe\u50cf\u591a\u5c3a\u5ea6\u8868\u793a\u65b9\u6cd5&#xff0c;\u7528\u4e8e\u56fe\u50cf\u5904\u7406\u4e2d\u7684\u5c3a\u5bf8\u7f29\u653e\u548c\u591a\u5206\u8fa8\u7387\u5206\u6790\u30021.\u9ad8\u65af\u91d1\u5b57\u5854\u64cd\u4f5c\u4e2d\u7684\u4e0b\u91c7\u6837\u4e0b\u91c7\u6837\u662f\u4e00\u79cd\u51cf\u5c0f\u56fe\u50cf\u5c3a\u5bf8\u7684\u65b9\u6cd5&#xff0c;\u5b83\u901a\u5e38\u6d89\u53ca\u5230\u964d\u4f4e\u56fe\u50cf\u7684\u5206\u8fa8\u7387&#xff0c;\u5373\u51cf\u5c11\u56fe\u50cf\u4e2d\u50cf\u7d20\u7684\u6570\u91cf&#xff0c;\u4ece\u800c\u4f7f\u56fe\u50cf\u770b\u8d77\u6765\u66f4\u5c0fimport cv2 imagecv2.imread(r&quot;D:\\project\\123s.jpg&quot;,0) cv2.imshow(image1,image)ima\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/64610.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-23T12:33:02+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260123123253-69736a75d39ac.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=\"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\/64610.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/64610.html\",\"name\":\"\u8ba1\u7b97\u673a\u89c6\u89c9opencv\u4e4b\u91d1\u5b57\u5854&amp;\u76f4\u65b9\u56fe - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-01-23T12:33:02+00:00\",\"dateModified\":\"2026-01-23T12:33:02+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/64610.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/64610.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/64610.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\u91d1\u5b57\u5854&amp;\u76f4\u65b9\u56fe\"}]},{\"@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\u91d1\u5b57\u5854&amp;\u76f4\u65b9\u56fe - \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\/64610.html","og_locale":"zh_CN","og_type":"article","og_title":"\u8ba1\u7b97\u673a\u89c6\u89c9opencv\u4e4b\u91d1\u5b57\u5854&amp;\u76f4\u65b9\u56fe - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u4e00\u3001\u91d1\u5b57\u5854&#xff08;\u4e00&#xff09;\u9ad8\u65af\u91d1\u5b57\u5854\u9ad8\u65af\u91d1\u5b57\u5854\u662f\u4e00\u79cd\u56fe\u50cf\u591a\u5c3a\u5ea6\u8868\u793a\u65b9\u6cd5&#xff0c;\u7528\u4e8e\u56fe\u50cf\u5904\u7406\u4e2d\u7684\u5c3a\u5bf8\u7f29\u653e\u548c\u591a\u5206\u8fa8\u7387\u5206\u6790\u30021.\u9ad8\u65af\u91d1\u5b57\u5854\u64cd\u4f5c\u4e2d\u7684\u4e0b\u91c7\u6837\u4e0b\u91c7\u6837\u662f\u4e00\u79cd\u51cf\u5c0f\u56fe\u50cf\u5c3a\u5bf8\u7684\u65b9\u6cd5&#xff0c;\u5b83\u901a\u5e38\u6d89\u53ca\u5230\u964d\u4f4e\u56fe\u50cf\u7684\u5206\u8fa8\u7387&#xff0c;\u5373\u51cf\u5c11\u56fe\u50cf\u4e2d\u50cf\u7d20\u7684\u6570\u91cf&#xff0c;\u4ece\u800c\u4f7f\u56fe\u50cf\u770b\u8d77\u6765\u66f4\u5c0fimport cv2 imagecv2.imread(r\"D:\\project\\123s.jpg\",0) cv2.imshow(image1,image)ima","og_url":"https:\/\/www.wsisp.com\/helps\/64610.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-01-23T12:33:02+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260123123253-69736a75d39ac.png"}],"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\/64610.html","url":"https:\/\/www.wsisp.com\/helps\/64610.html","name":"\u8ba1\u7b97\u673a\u89c6\u89c9opencv\u4e4b\u91d1\u5b57\u5854&amp;\u76f4\u65b9\u56fe - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-01-23T12:33:02+00:00","dateModified":"2026-01-23T12:33:02+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/64610.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/64610.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/64610.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\u91d1\u5b57\u5854&amp;\u76f4\u65b9\u56fe"}]},{"@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\/64610","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=64610"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/64610\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/64600"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=64610"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=64610"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=64610"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=64610"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}