{"id":1323,"date":"2023-03-25T10:12:45","date_gmt":"2023-03-25T02:12:45","guid":{"rendered":""},"modified":"2023-03-25T10:12:45","modified_gmt":"2023-03-25T02:12:45","slug":"\u8ba1\u7b97\u673a\u89c6\u89c9","status":"publish","type":"post","link":"https:\/\/bianchenghao6.com\/1323.html","title":{"rendered":"\u8ba1\u7b97\u673a\u89c6\u89c9"},"content":{"rendered":"


\n <\/head>
\n <\/p>\n

\n

\u8ba1\u7b97\u673a\u89c6\u89c9<\/h1>\n

\u8ba1\u7b97\u673a\u89c6\u89c9\u8be6\u7ec6\u64cd\u4f5c\u6559\u7a0b<\/span>\n <\/div>\n

\n \u8ba1\u7b97\u673a\u89c6\u89c9\u6d89\u53ca\u4f7f\u7528\u8ba1\u7b97\u673a\u8f6f\u4ef6\u548c\u786c\u4ef6\u5efa\u6a21\u548c\u590d\u5236\u4eba\u7c7b\u89c6\u89c9\u3002 \u5728\u672c\u7ae0\u4e2d\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u5730\u5b66\u4e60\u3002\n <\/div>\n

\u8ba1\u7b97\u673a\u89c6\u89c9<\/h2>\n
\n \u8ba1\u7b97\u673a\u89c6\u89c9\u662f\u4e00\u95e8\u5b66\u79d1\uff0c\u6839\u636e\u573a\u666f\u4e2d\u5b58\u5728\u7684\u7ed3\u6784\u7279\u6027\uff0c\u7814\u7a76\u5982\u4f55\u4ece2D\u56fe\u50cf\u91cd\u6784\uff0c\u4e2d\u65ad\u548c\u7406\u89e33D\u573a\u666f\u3002\n <\/div>\n
\n \u8ba1\u7b97\u673a\u89c6\u89c9\u5c42\u6b21\u7ed3\u6784<\/strong>\n <\/div>\n
\n \u8ba1\u7b97\u673a\u89c6\u89c9\u5206\u4e3a\u4ee5\u4e0b\u4e09\u4e2a\u57fa\u672c\u7c7b\u522b -\n <\/div>\n

\u4f4e\u7ea7\u89c6\u89c9<\/strong> - \u5b83\u5305\u62ec\u7528\u4e8e\u7279\u5f81\u63d0\u53d6\u7684\u8fc7\u7a0b\u56fe\u50cf\u3002<\/span>
\n \u4e2d\u7ea7\u89c6\u89c9<\/strong> - \u5b83\u5305\u62ec\u7269\u4f53\u8bc6\u522b\u548c3D\u573a\u666f\u89e3\u91ca<\/span>
\n \u9ad8\u7ea7\u89c6\u89c9<\/strong> - \u5b83\u5305\u62ec\u5bf9\u6d3b\u52a8\uff0c\u610f\u56fe\u548c\u884c\u4e3a\u7b49\u573a\u666f\u7684\u6982\u5ff5\u6027\u63cf\u8ff0\u3002<\/span> <\/p>\n

\u8ba1\u7b97\u673a\u89c6\u89c9\u4e0e\u56fe\u50cf\u5904\u7406<\/h2>\n
\n \u56fe\u50cf\u5904\u7406\u5c06\u56fe\u50cf\u8f6c\u6362\u4e3a\u56fe\u50cf\u3002 \u56fe\u50cf\u5904\u7406\u7684\u8f93\u5165\u548c\u8f93\u51fa\u90fd\u662f\u56fe\u50cf\u3002\n <\/div>\n
\n \u8ba1\u7b97\u673a\u89c6\u89c9\u662f\u4ece\u5176\u56fe\u50cf\u4e2d\u6784\u5efa\u5bf9\u7269\u7406\u5bf9\u8c61\u7684\u660e\u786e\u800c\u6709\u610f\u4e49\u7684\u63cf\u8ff0\u3002 \u8ba1\u7b97\u673a\u89c6\u89c9\u7684\u8f93\u51fa\u662f3D\u573a\u666f\u4e2d\u7ed3\u6784\u7684\u63cf\u8ff0\u6216\u89e3\u91ca\u3002\n <\/div>\n
\n \u5e94\u7528<\/strong>\u8ba1\u7b97\u673a\u89c6\u89c9\u5728\u4ee5\u4e0b\u9886\u57df\u4e2d\u5e94\u7528 -\n <\/div>\n
\n \u673a\u5668\u4eba\u9886\u57df<\/strong>
\n \u672c\u5730\u5316 - \u81ea\u52a8\u786e\u5b9a\u673a\u5668\u4eba\u4f4d\u7f6e<\/span>
\n \u5bfc\u822a<\/span>
\n \u907f\u514d\u969c\u788d<\/span>
\n \u88c5\u914d(\u63d2\u5165\u5b54\uff0c\u710a\u63a5\uff0c\u55b7\u6f06)<\/span>
\n \u64cd\u4f5c(\u4f8b\u5982PUMA\u673a\u5668\u4eba\u64cd\u4f5c\u5668)<\/span>
\n \u4eba\u673a\u5668\u4eba\u4ea4\u4e92(HRI):\u667a\u80fd\u673a\u5668\u4eba\u4e0e\u4eba\u4ea4\u4e92\u548c\u670d\u52a1<\/span>\n <\/div>\n

\u533b\u5b66\u9886\u57df<\/strong> \u5206\u7c7b\u548c\u68c0\u6d4b(\u4f8b\u5982\u75c5\u53d8\u6216\u7ec6\u80de\u5206\u7c7b\u548c\u80bf\u7624\u68c0\u6d4b)<\/span> 2D\/3D\u5206\u5272<\/span> 3D\u4eba\u4f53\u5668\u5b98\u91cd\u5efa(MRI\u6216\u8d85\u58f0\u6ce2)<\/span> \u89c6\u89c9\u5f15\u5bfc\u7684\u673a\u5668\u4eba\u624b\u672f<\/span> <\/span>
\n \u5b89\u5168\u9886\u57df<\/strong> \u751f\u7269\u8bc6\u522b\u6280\u672f(\u8679\u819c\uff0c\u6307\u7eb9\uff0c\u8138\u90e8\u8bc6\u522b)<\/span> \u76d1\u89c6 - \u68c0\u6d4b\u67d0\u4e9b\u53ef\u7591\u7684\u6d3b\u52a8\u6216\u884c\u4e3a<\/span> <\/span>
\n \u8fd0\u8f93<\/strong> \u81ea\u4e3b\u8f66\u8f86<\/span> \u5b89\u5168\uff0c\u4f8b\u5982\u9a7e\u9a76\u5458\u8b66\u60d5\u6027\u76d1\u63a7<\/span> <\/span>
\n \u5de5\u4e1a\u81ea\u52a8\u5316\u5e94\u7528<\/strong> \u5de5\u4e1a\u68c0\u67e5(\u7f3a\u9677\u68c0\u6d4b)<\/span> \u90e8\u4ef6<\/span> \u6761\u7801\u548c\u5305\u88c5\u6807\u7b7e\u9605\u8bfb<\/span> \u5bf9\u8c61\u6392\u5e8f<\/span> \u6587\u4ef6\u7406\u89e3(\u4f8b\u5982OCR)<\/span> <\/span> <\/p>\n

\u5b89\u88c5\u6709\u7528\u7684\u5305<\/h2>\n
\n \u5bf9\u4e8e\u4f7f\u7528Python\u7684\u8ba1\u7b97\u673a\u89c6\u89c9\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u540d\u4e3aOpenCV(\u5f00\u6e90\u8ba1\u7b97\u673a\u89c6\u89c9)\u7684\u6d41\u884c\u5e93\u3002 \u5b83\u662f\u4e00\u4e2a\u4e3b\u8981\u9488\u5bf9\u5b9e\u65f6\u8ba1\u7b97\u673a\u89c6\u89c9\u7684\u7f16\u7a0b\u529f\u80fd\u5e93\u3002 \u5b83\u7528C++\u7f16\u5199\uff0c\u5176\u4e3b\u8981\u63a5\u53e3\u662fC++\u3002 \u53ef\u4ee5\u501f\u52a9\u4ee5\u4e0b\u547d\u4ee4\u6765\u5b89\u88c5\u6b64\u8f6f\u4ef6\u5305 -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
pip install opencv_python-X.X-cp36-cp36m-winX.whl
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u8fd9\u91ccX\u4ee3\u8868\u793a\u673a\u5668\u4e0a\u5b89\u88c5\u7684Python\u7248\u672c\uff0c\u4ee5\u53ca\u6240\u62e5\u6709\u7684win32\u621664\u4f4d\u7248\u672c\u3002\n <\/div>\n
\n \u5982\u679c\u60a8\u4f7f\u7528\u7684\u662fanaconda\u73af\u5883\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5OpenCV -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
conda install -c conda-forge opencv
<\/span><\/code><\/pre>\n<\/p><\/div>\n

\u8bfb\u53d6\uff0c\u5199\u5165\u548c\u663e\u793a\u56fe\u50cf<\/h2>\n
\n \u5927\u591a\u6570CV\u5e94\u7528\u7a0b\u5e8f\u9700\u8981\u5c06\u56fe\u50cf\u4f5c\u4e3a\u8f93\u5165\u5e76\u751f\u6210\u56fe\u50cf\u4f5c\u4e3a\u8f93\u51fa\u3002 \u5728\u672c\u8282\u4e2d\uff0c\u60a8\u5c06\u5b66\u4e60\u5982\u4f55\u501f\u52a9OpenCV\u63d0\u4f9b\u7684\u529f\u80fd\u6765\u8bfb\u53d6\u548c\u5199\u5165\u56fe\u50cf\u6587\u4ef6\u3002OpenCV\u7528\u4e8e\u8bfb\u53d6\uff0c\u663e\u793a\uff0c\u7f16\u5199\u56fe\u50cf\u6587\u4ef6OpenCV\u4e3a\u6b64\u63d0\u4f9b\u4e86\u4ee5\u4e0b\u51fd\u6570\u529f\u80fd -\n <\/div>\n

<\/p>\n

\n imread()\u51fd\u6570 - \u8fd9\u662f\u8bfb\u53d6\u56fe\u50cf\u7684\u51fd\u6570\u3002 OpenCV imread()\u652f\u6301\u5404\u79cd\u56fe\u50cf\u683c\u5f0f\uff0c\u5982PNG\uff0cJPEG\uff0cJPG\uff0cTIFF\u7b49\u3002\n <\/div>\n

<\/span>
\n <\/p>\n

\n imshow()\u51fd\u6570 - \u8fd9\u662f\u7528\u4e8e\u5728\u7a97\u53e3\u4e2d\u663e\u793a\u56fe\u50cf\u7684\u51fd\u6570\u3002 \u8be5\u7a97\u53e3\u81ea\u52a8\u9002\u5408\u56fe\u50cf\u5927\u5c0f\u3002 OpenCV imshow()\u652f\u6301\u5404\u79cd\u56fe\u50cf\u683c\u5f0f\uff0c\u5982PNG\uff0cJPEG\uff0cJPG\uff0cTIFF\u7b49\u3002\n <\/div>\n

<\/span>
\n <\/p>\n

\n imwrite()\u51fd\u6570 - \u8fd9\u662f\u5199\u5165\u56fe\u50cf\u7684\u51fd\u6570\u3002 OpenCV imwrite()\u652f\u6301\u5404\u79cd\u56fe\u50cf\u683c\u5f0f\uff0c\u5982PNG\uff0cJPEG\uff0cJPG\uff0cTIFF\u7b49\u3002\n <\/div>\n

<\/span> <\/p>\n

\n \u793a\u4f8b<\/strong>\n <\/div>\n
\n \u8fd9\u4e2a\u4f8b\u5b50\u5c55\u793a\u4e86\u7528\u4e8e\u4ee5\u4e00\u79cd\u683c\u5f0f\u8bfb\u53d6\u56fe\u50cf\u7684Python\u4ee3\u7801 - \u5728\u4e00\u4e2a\u7a97\u53e3\u4e2d\u663e\u793a\u5b83\uff0c\u5e76\u4ee5\u5176\u4ed6\u683c\u5f0f\u5199\u5165\u76f8\u540c\u7684\u56fe\u50cf\u3002 \u8003\u8651\u4e0b\u9762\u663e\u793a\u7684\u6b65\u9aa4 -\n <\/div>\n
\n \u5982\u4e0b\u6240\u793a\u5bfc\u5165OpenCV\u5305 -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
import <\/span>cv2
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u73b0\u5728\uff0c\u4f7f\u7528imread()\u51fd\u6570\u8bfb\u53d6\u4e00\u4e2a\u7279\u5b9a\u7684\u56fe\u50cf -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
image = cv2.imread<\/span>('image_flower.jpg'<\/span>)
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u8981\u663e\u793a\u56fe\u50cf\uff0c\u53ef\u4f7f\u7528imshow()\u51fd\u6570\u3002\u53ef\u4ee5\u5728\u5176\u4e2d\u770b\u5230\u56fe\u50cf\u7684\u7a97\u53e3\u7684\u540d\u79f0\u662fimage_flower\u3002\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
cv2.imshow<\/span>('image_flower'<\/span>,image)
cv2.destroyAllwindows<\/span>()
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u6267\u884c\u4ee3\u7801\u540e\uff0c\u5f97\u5230\u56fe\u7247\u5982\u4e0b -\n <\/div>\n
\n \u8ba1\u7b97\u673a\u89c6\u89c9_https:\/\/bianchenghao6.com_\u3010\u4eba\u5de5\u667a\u80fd\u6559\u7a0b\u3011_\u7b2c1\u5f20\n <\/div>\n
\n \u53ef\u4ee5\u4f7f\u7528imwrite()\u51fd\u6570\u5c06\u76f8\u540c\u7684\u56fe\u50cf\u5199\u5165\u5176\u4ed6\u683c\u5f0f\uff0c\u6bd4\u5982.png\uff0c\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
cv2.imwrite<\/span>('image_flower.png'<\/span>,image)
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u8f93\u51faTrue\u8868\u793a\u56fe\u50cf\u5df2\u6210\u529f\u5199\u5165.png\u6587\u4ef6\uff0c\u5e76\u4e14\u4e5f\u4f4d\u4e8e\u540c\u4e00\u6587\u4ef6\u5939\u4e2d\u3002\n <\/div>\n
\n
\n \u6ce8 - \u51fd\u6570destroyallWindows()\u7b80\u5355\u5730\u9500\u6bc1\u521b\u5efa\u7684\u6240\u6709\u7a97\u53e3\u3002\n <\/div>\n<\/blockquote>\n

\u8272\u5f69\u7a7a\u95f4\u8f6c\u6362<\/h2>\n
\n \u5728OpenCV\u4e2d\uff0c\u56fe\u50cf\u4e0d\u662f\u4f7f\u7528\u4f20\u7edf\u7684RGB\u989c\u8272\u5b58\u50a8\u7684\uff0c\u800c\u662f\u4ee5\u76f8\u53cd\u7684\u987a\u5e8f\u5b58\u50a8\u7684\uff0c\u5373\u4ee5BGR\u987a\u5e8f\u5b58\u50a8\u3002 \u56e0\u6b64\uff0c\u8bfb\u53d6\u56fe\u50cf\u65f6\u7684\u9ed8\u8ba4\u989c\u8272\u4ee3\u7801\u662fBGR\u3002 cvtColor()\u989c\u8272\u8f6c\u6362\u51fd\u6570\u7528\u4e8e\u5c06\u56fe\u50cf\u4ece\u4e00\u4e2a\u989c\u8272\u4ee3\u7801\u8f6c\u6362\u4e3a\u5176\u4ed6\u989c\u8272\u4ee3\u7801\u3002\n <\/div>\n
\n \u793a\u4f8b<\/strong>\n <\/div>\n
\n \u8003\u8651\u8fd9\u4e2a\u4f8b\u5b50\uff0c\u5c06\u56fe\u50cf\u4eceBGR\u8f6c\u6362\u4e3a\u7070\u5ea6\u3002\n <\/div>\n
\n \u5982\u4e0b\u6240\u793a\u5bfc\u5165OpenCV\u5305 -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
import <\/span>cv2
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u4f7f\u7528imread()\u51fd\u6570\u8bfb\u53d6\u4e00\u4e2a\u7279\u5b9a\u7684\u56fe\u50cf -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
image = cv2.imread<\/span>('image_flower.jpg'<\/span>)
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u73b0\u5728\uff0c\u5982\u679c\u4f7f\u7528imshow()\u51fd\u6570\u6765\u663e\u793a\u8fd9\u4e2a\u56fe\u50cf\uff0c\u90a3\u4e48\u53ef\u4ee5\u770b\u5230\u8fd9\u4e2a\u56fe\u50cf\u5728BGR\u4e2d\u3002\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
cv2.imshow<\/span>('BGR_Penguins'<\/span>,image)
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u8ba1\u7b97\u673a\u89c6\u89c9_https:\/\/bianchenghao6.com_\u3010\u4eba\u5de5\u667a\u80fd\u6559\u7a0b\u3011_\u7b2c2\u5f20\n <\/div>\n
\n \u73b0\u5728\uff0c\u4f7f\u7528cvtColor()\u51fd\u6570\u5c06\u6b64\u56fe\u50cf\u8f6c\u6362\u4e3a\u7070\u5ea6\u3002\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
image = cv2.cvtColor<\/span>(image,cv2.COLOR_BGR2GRAY)
cv2.imshow<\/span>('gray_penguins'<\/span>,image)
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u8ba1\u7b97\u673a\u89c6\u89c9_https:\/\/bianchenghao6.com_\u3010\u4eba\u5de5\u667a\u80fd\u6559\u7a0b\u3011_\u7b2c3\u5f20\n <\/div>\n

<\/span>\u8fb9\u7f18\u68c0\u6d4b<\/h2>\n
\n \u4eba\u7c7b\u5728\u770b\u5230\u7c97\u7cd9\u7684\u8349\u56fe\u540e\uff0c\u53ef\u4ee5\u8f7b\u677e\u8bc6\u522b\u51fa\u8bb8\u591a\u7269\u4f53\u7c7b\u578b\u53ca\u5176\u59ff\u6001\u3002 \u8fd9\u5c31\u662f\u4e3a\u4ec0\u4e48\u8fb9\u7f18\u5728\u4eba\u7c7b\u751f\u6d3b\u4ee5\u53ca\u8ba1\u7b97\u673a\u89c6\u89c9\u5e94\u7528\u4e2d\u626e\u6f14\u91cd\u8981\u89d2\u8272\u7684\u539f\u56e0\u3002 OpenCV\u63d0\u4f9b\u4e86\u975e\u5e38\u7b80\u5355\u800c\u6709\u7528\u7684\u51fd\u6570Canny()\u6765\u68c0\u6d4b\u8fb9\u7f18\u3002\n <\/div>\n
\n \u793a\u4f8b<\/strong>\n <\/div>\n
\n \u4ee5\u4e0b\u793a\u4f8b\u663e\u793a\u4e86\u8fb9\u7f18\u7684\u6e05\u6670\u6807\u8bc6\u3002\n <\/div>\n
\n \u5982\u4e0b\u6240\u793a\u5bfc\u5165OpenCV\u5305 -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
import <\/span>cv2
import <\/span>numpy as <\/span>np
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u4f7f\u7528imread()\u51fd\u6570\u8bfb\u53d6\u4e00\u4e2a\u6307\u5b9a\u7684\u56fe\u50cf -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
image = cv2.imread<\/span>('Penguins.jpg'<\/span>)
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u73b0\u5728\uff0c\u4f7f\u7528Canny()\u51fd\u6570\u6765\u68c0\u6d4b\u5df2\u8bfb\u56fe\u50cf\u7684\u8fb9\u7f18\u3002\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
cv2.imwrite<\/span>('edges_Penguins.jpg'<\/span>,cv2.Canny<\/span>(image,200,300))
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u8981\u663e\u793a\u5177\u6709\u8fb9\u7f18\u7684\u56fe\u50cf\uff0c\u8bf7\u4f7f\u7528imshow()\u51fd\u6570\uff0c\u53c2\u8003\u4ee5\u4e0b\u4ee3\u7801 -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
cv2.imshow<\/span>('edges'<\/span>, cv2.imread<\/span>('edges_Penguins.jpg'<\/span>))
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u8fd9\u4e2aPython\u7a0b\u5e8f\u5c06\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a
\n edges_penguins.jpg<\/em> \u7684\u56fe\u50cf\u5e76\u8fdb\u884c\u8fb9\u7f18\u68c0\u6d4b\u3002\n <\/div>\n
\n \u8ba1\u7b97\u673a\u89c6\u89c9_https:\/\/bianchenghao6.com_\u3010\u4eba\u5de5\u667a\u80fd\u6559\u7a0b\u3011_\u7b2c4\u5f20\n <\/div>\n

<\/span>\u4eba\u8138\u68c0\u6d4b<\/h2>\n
\n \u4eba\u8138\u68c0\u6d4b\u662f\u8ba1\u7b97\u673a\u89c6\u89c9\u7684\u4ee4\u4eba\u7740\u8ff7\u7684\u5e94\u7528\u4e4b\u4e00\uff0c\u5b83\u4f7f\u5176\u66f4\u52a0\u903c\u771f\u3002 OpenCV\u6709\u4e00\u4e2a\u5185\u7f6e\u7684\u5de5\u5177\u6765\u6267\u884c\u4eba\u8138\u68c0\u6d4b\u3002 \u6211\u4eec\u5c06\u4f7f\u7528Haar\u7ea7\u8054\u5206\u7c7b\u5668\u8fdb\u884c\u4eba\u8138\u68c0\u6d4b\u3002\n <\/div>\n

<\/span>Haar\u7ea7\u8054\u6570\u636e<\/h3>\n
\n \u6211\u4eec\u9700\u8981\u6570\u636e\u6765\u4f7f\u7528Haar\u7ea7\u8054\u5206\u7c7b\u5668\u3002 \u53ef\u4ee5\u5728\u6211\u4eec\u7684OpenCV\u5305\u4e2d\u627e\u5230\u8fd9\u4e9b\u6570\u636e\u3002 \u5b89\u88c5OpenCv\u540e\uff0c\u6709\u4e00\u4e2a\u6587\u4ef6\u5939\u540d\u79f0haarcascades\u3002 \u5c06\u6709\u4e0d\u540c\u5e94\u7528\u7a0b\u5e8f\u7684.xml\u6587\u4ef6\u3002 \u73b0\u5728\uff0c\u5c06\u5b83\u4eec\u5168\u90e8\u590d\u5236\u4ee5\u4f9b\u4e0d\u540c\u7684\u4f7f\u7528\uff0c\u7136\u540e\u7c98\u8d34\u5230\u5f53\u524d\u9879\u76ee\u4e0b\u7684\u65b0\u6587\u4ef6\u5939\u4e2d\u3002\n <\/div>\n
\n \u793a\u4f8b<\/strong>\n <\/div>\n
\n \u4ee5\u4e0b\u662f\u4f7f\u7528Haar\u7ea7\u8054\u68c0\u6d4b\u4e0b\u56fe\u4e2d\u663e\u793a\u7684Amitabh Bachan\u7684\u9762\u90e8\u7684Python\u4ee3\u7801 -\n <\/div>\n
\n \u8ba1\u7b97\u673a\u89c6\u89c9_https:\/\/bianchenghao6.com_\u3010\u4eba\u5de5\u667a\u80fd\u6559\u7a0b\u3011_\u7b2c5\u5f20\n <\/div>\n
\n \u5982\u4e0b\u6240\u793a\u5bfc\u5165OpenCV\u5305 -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
import <\/span>cv2
import <\/span>numpy as <\/span>np
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u73b0\u5728\uff0c\u4f7f\u7528HaarCascadeClassifier\u6765\u68c0\u6d4b\u8138\u90e8 -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
face_detection=
cv2.CascadeClassifier<\/span>('D:\/ProgramData\/cascadeclassifier\/
haarcascade_frontalface_default.xml')
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u4f7f\u7528imread()\u51fd\u6570\u8bfb\u53d6\u4e00\u4e2a\u6307\u5b9a\u7684\u56fe\u50cf\uff0c\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
img = cv2.imread<\/span>('AB.jpg'<\/span>)
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u5c06\u5176\u8f6c\u6362\u4e3a\u7070\u5ea6\uff0c\u56e0\u4e3a\u5b83\u4f1a\u63a5\u53d7\u7070\u8272\u56fe\u50cf -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
gray = cv2.cvtColor<\/span>(img, cv2.COLOR_BGR2GRAY)
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u63a5\u4e0b\u6765\uff0c\u4f7f\u7528face_detection.detectMultiScale\uff0c\u6267\u884c\u5b9e\u9645\u7684\u4eba\u8138\u68c0\u6d4b\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
faces = face_detection.detectMultiScale<\/span>(gray, 1.3, 5)
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u56f4\u7ed5\u6574\u4e2a\u8138\u90e8\u7ed8\u5236\u4e00\u4e2a\u77e9\u5f62 -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
for <\/span><\/span>(x,y,w,h) in <\/span>faces:
   img = cv2.rectangle<\/span>(img,(x,y),(x+w, y+h),(255,0,0),3)
cv2.imwrite<\/span>('Face_AB.jpg'<\/span>,img)
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u5982\u56fe\u6240\u793a\uff0c\u8fd9\u4e2aPython\u7a0b\u5e8f\u5c06\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a
\n Face_AB.jpg<\/em> \u7684\u56fe\u50cf\uff0c\u5b83\u5305\u542b\u4eba\u8138\u68c0\u6d4b -\n <\/div>\n

\u8ba1\u7b97\u673a\u89c6\u89c9_https:\/\/bianchenghao6.com_\u3010\u4eba\u5de5\u667a\u80fd\u6559\u7a0b\u3011_\u7b2c6\u5f20 <\/p>\n

<\/span>\u773c\u775b\u68c0\u6d4b<\/h2>\n
\n \u773c\u775b\u68c0\u6d4b\u662f\u8ba1\u7b97\u673a\u89c6\u89c9\u7684\u53e6\u4e00\u4e2a\u5f15\u4eba\u6ce8\u76ee\u7684\u5e94\u7528\uff0c\u4f7f\u5176\u66f4\u52a0\u903c\u771f\u548c\u672a\u6765\u3002 OpenCV\u6709\u4e00\u4e2a\u5185\u7f6e\u7684\u5de5\u5177\u6765\u6267\u884c\u773c\u775b\u68c0\u6d4b\u3002 \u6211\u4eec\u5c06\u4f7f\u7528Haar\u7ea7\u8054\u5206\u7c7b\u5668\u8fdb\u884c\u773c\u775b\u68c0\u6d4b\u3002\n <\/div>\n
\n \u793a\u4f8b<\/strong>\u4ee5\u4e0b\u793a\u4f8b\u7ed9\u51fa\u4e86\u4f7f\u7528Haar\u7ea7\u8054\u7684Python\u4ee3\u7801\u6765\u68c0\u6d4b\u4e0b\u56fe\u4e2d\u7ed9\u51fa\u7684
\n Amitabh Bachan<\/em> \u7684\u9762\u90e8 -\n <\/div>\n
\n \u8ba1\u7b97\u673a\u89c6\u89c9_https:\/\/bianchenghao6.com_\u3010\u4eba\u5de5\u667a\u80fd\u6559\u7a0b\u3011_\u7b2c7\u5f20\n <\/div>\n
\n \u5982\u4e0b\u6240\u793a\u5bfc\u5165OpenCV\u5305 -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
import <\/span>cv2
import <\/span>numpy as <\/span>np
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u4f7f\u7528HaarCascadeClassifier\u68c0\u6d4b\u8138\u90e8 -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
eye_cascade = cv2.CascadeClassifier<\/span>('D:\/ProgramData\/cascadeclassifier\/haarcascade_eye.xml'<\/span>)
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u4f7f\u7528imread()\u51fd\u6570\u8bfb\u53d6\u6307\u5b9a\u56fe\u50cf -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
img = cv2.imread<\/span>('AB_Eye.jpg'<\/span>)
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u7136\u540e\uff0c\u5c06\u5176\u8f6c\u6362\u4e3a\u7070\u5ea6\uff0c\u56e0\u4e3a\u5b83\u4f1a\u63a5\u53d7\u7070\u8272\u56fe\u50cf -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
gray = cv2.cvtColor<\/span>(img, cv2.COLOR_BGR2GRAY)
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u4f7f\u7528 eye_cascade.detectMultiScale \uff0c\u6267\u884c\u5b9e\u9645\u7684\u4eba\u8138\u68c0\u6d4b -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
eyes = eye_cascade.detectMultiScale<\/span>(gray, 1.03, 5)
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u73b0\u5728\uff0c\u56f4\u7ed5\u6574\u4e2a\u8138\u90e8\u7ed8\u5236\u4e00\u4e2a\u77e9\u5f62 -\n <\/div>\n
\n
 # Filename : example.py<\/span>
# Copyright : 2020 By Lidihuo<\/span>
# Author by : www.lidihuo.com<\/span>
# Date : 2020-08-26<\/span>
for <\/span><\/span>(ex,ey,ew,eh) in <\/span>eyes:
   img = cv2.rectangle<\/span>(img,(ex,ey),(ex+ew, ey+eh),(0,255,0),2)
cv2.imwrite<\/span>('Eye_AB.jpg'<\/span>,img)
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n \u8fd9\u4e2aPython\u7a0b\u5e8f\u5c06\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a
\n Eye_AB.jpg<\/em> \u7684\u56fe\u50cf\uff0c\u5982\u56fe\u6240\u793a\uff0c\n <\/div>\n
\n \u8ba1\u7b97\u673a\u89c6\u89c9_https:\/\/bianchenghao6.com_\u3010\u4eba\u5de5\u667a\u80fd\u6559\u7a0b\u3011_\u7b2c8\u5f20\n <\/div>\n

<\/body>
\n<\/html><\/p>\n","protected":false},"excerpt":{"rendered":"\u8ba1\u7b97\u673a\u89c6\u89c9zh-cn","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[137],"tags":[],"class_list":["post-1323","post","type-post","status-publish","format-standard","hentry","category-rgznjc1"],"_links":{"self":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts\/1323"}],"collection":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/comments?post=1323"}],"version-history":[{"count":0,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts\/1323\/revisions"}],"wp:attachment":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/media?parent=1323"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/categories?post=1323"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/tags?post=1323"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}