{"id":556,"date":"2021-11-29T08:58:12","date_gmt":"2021-11-29T00:58:12","guid":{"rendered":"http:\/\/hower.forwebs.net\/robot\/?p=556"},"modified":"2021-12-19T21:35:46","modified_gmt":"2021-12-19T13:35:46","slug":"%e7%ac%ac12%e5%a0%82-%e6%a9%9f%e5%99%a8%e4%ba%ba%e8%a6%96%e8%a6%ba-ai%e5%bd%b1%e5%83%8f%e8%be%a8%e8%ad%98","status":"publish","type":"post","link":"https:\/\/hower.forwebs.net\/robot\/archives\/556","title":{"rendered":"\u7b2c12\u5802 \u6a5f\u5668\u4eba\u8996\u89ba-AI\u4eba\u81c9\u8fa8\u8b58"},"content":{"rendered":"\n<p>WebCam<\/p>\n\n\n\n<p>\u5982\u4f55\u6e2c\u8a66?<\/p>\n\n\n\n<p>\u5982\u4f55\u62cd\u7167\u6216\u9304\u5f71?<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u64f7\u53d6\u4e00\u5f35\u6709\u4eba\u81c9\u7684\u5716\u7247<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>Python\u4ecb\u7d39<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<div class=\"video-container\"><iframe loading=\"lazy\" title=\"T8\u5c0f\u6559\u5ba4#6 \u7a0b\u5f0f\u65b0\u624b\u5b78\u7fd2Python\u7684\u4e94\u5927\u7406\u7531\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/ZhchcGLttko?feature=oembed&#038;wmode=opaque\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/div>\n<\/div><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u5b89\u88dd Python<\/p>\n\n\n\n<p>\u5343\u842c\u6ce8\u610f\u4e00\u500b\u5c0f\u7d30\u7bc0&#8230;<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u7591\u60d1<\/p>\n\n\n\n<ul><li>\u53c8\u8981\u5b78\u65b0\u8a9e\u8a00? \u6211C\u90fd\u9084\u4e0d\u719f&#8230; <br>\u8a66\u8a66\u770b\uff0c\u8aaa\u4e0d\u5b9a\u4f60\u8ddfpython\u66f4\u5bb9\u6613\u6df7\u719f<br>\u8acb\u770b\u4e0b\u9762\u5f71\u7247&#8230;<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<div class=\"video-container\"><iframe loading=\"lazy\" title=\"\u3010\u7a0b\u5f0f\u8a9e\u8a00\u5165\u9580\u9808\u77e5\u3011\u4e0a\u96c6 | \u65b0\u624b\u8a72\u5b78\u54ea\u500b\u7a0b\u5f0f\u8a9e\u8a00\uff1f\u5de5\u7a0b\u5e2b\u90fd\u7528\u4ec0\u9ebc\u7a0b\u5f0f\u8a9e\u8a00\uff1f\u6700\u5f37\u7a0b\u5f0f\u8a9e\u8a00\u662f\uff1f | What you should know about programming languages\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/fcmXuZtsQ6Y?feature=oembed&#038;wmode=opaque\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/div>\n<\/div><\/figure>\n\n\n\n<ul><li>\u5b78\u9019\u9ebc\u591a\u6703\u4e0d\u6703\u5e72\u64fe?<br>\u5e72\u64fe\u4e5f\u6c92\u5dee\uff0c\u8edf\u9ad4\u958b\u767c\u53c8\u4e0d\u662f\u5728\u8003\u8a66\uff0c\u53ef\u4ee5open book\uff0c\u53ef\u4ee5\u96a8\u6642\u67e5\u95b1\uff0c\u4f7f\u7528\u6b66\u6797\u795e\u529f&#8221;\u8907\u88fd\u8cbc\u4e0a&#8221;<\/li><li>\u5b78\u9019\u9ebc\u591a\u6709\u4f55\u512a\u9ede?<br>\u56de\u60f3\u525b\u624d\u7684\u5f71\u7247<br>\u898b\u591a\u8b58\u5ee3\uff0c\u8981\u89e3\u6c7a\u554f\u984c\u6642\u5c31\u53ef\u4ee5\u6bd4\u5225\u4eba\u60f3\u5230\u66f4\u591a\u5de5\u5177\uff0c\u4f8b\u5982Matlab, Python, JavaScript&#8230;<\/li><li>\u5b78\u9019\u9ebc\u591a\u6709\u4f55\u7f3a\u9ede?<br>\u6211\u60f3\u4e0d\u5230\uff0c\u4f60\u5e6b\u6211\u60f3\u60f3<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<div class=\"video-container\"><iframe loading=\"lazy\" title=\"\u958b\u767c\u8edf\u9ad4\u4e94\u5e74\uff0c\u6211\u5b78\u7fd2\u7684\u6bcf\u4e00\u9805\u6280\u8853 | \u5728\u5730\u4e0a\u6efe\u7684\u5de5\u7a0b\u5e2b Nic\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/43Goge_4AYU?start=204&#038;feature=oembed&#038;wmode=opaque\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/div>\n<\/div><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u671f\u5f85\u7576\u5de5\u7a0b\u5e2b\u4e86\u55ce?<\/p>\n\n\n\n<p>\u99ac\u4e0a\u5b89\u88dd\u696d\u754c\u6700\u591a\u4eba\u7528\u7684 Visual Studio Code<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u958b\u59cbAI\u5f71\u50cf\u8fa8\u8b58\u56c9\uff0c\u5b89\u88dd Opencv for Python<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip install opencv-python<\/code><\/pre>\n\n\n\n<p>\u5e38\u898b\u554f\u984c?<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u4eba\u81c9\u8fa8\u8b58\u7bc4\u4f8b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import cv2\n\ndef detectFace(img):\n    filename = img.split(\".\")&#91;0] # \u53d6\u5f97\u6a94\u6848\u540d\u7a31(\u4e0d\u6dfb\u52a0\u526f\u6a94\u540d)\n    img = cv2.imread(img) # \u8b80\u53d6\u5716\u6a94\n    grayImg = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) # \u900f\u904e\u8f49\u63db\u51fd\u5f0f\u8f49\u70ba\u7070\u968e\u5f71\u50cf\n    color = (0, 255, 0)  # \u5b9a\u7fa9\u6846\u7684\u984f\u8272\n    \n    # OpenCV \u4eba\u81c9\u8b58\u5225\u5206\u985e\u5668\n    face_classifier = cv2.CascadeClassifier(cv2.data.haarcascades + \"haarcascade_frontalface_default.xml\")\n    \n    # \u8abf\u7528\u5075\u6e2c\u8b58\u5225\u4eba\u81c9\u51fd\u5f0f\n    faceRects = face_classifier.detectMultiScale(\n        grayImg, scaleFactor=1.2, minNeighbors=3, minSize=(32, 32))\n    \n    # \u5927\u65bc 0 \u5247\u6aa2\u6e2c\u5230\u4eba\u81c9\n    if len(faceRects):  \n        # \u6846\u51fa\u6bcf\u4e00\u5f35\u4eba\u81c9\n        for faceRect in faceRects: \n            x, y, w, h = faceRect\n            cv2.rectangle(img, (x, y), (x + h, y + w), color, 2)\n    \n    # \u5c07\u7d50\u679c\u5716\u7247\u8f38\u51fa\n    cv2.imwrite(filename + \"_face.jpg\", img)\n    \ndetectFace('2.jpg')<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u725b\u5200\u5c0f\u8a66<\/p>\n\n\n\n<p>\u628a\u4e0a\u9762\u7684\u4eba\u81c9\u6846\u6539\u6210\u7d2b\u8272<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u81ea\u52d5\u986f\u793a\u5716\u72473\u79d2<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>img2 = cv2.imread('2_face.jpg')\ncv2.imshow(\"OK\", img2)\ncv2.waitKey(3000)\ncv2.destroyAllWindows()<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u4eca\u5929\u8a8d\u8b58Python\u4e4b\u5f8c\uff0c\u8a18\u4f4f3\u500b\u91cd\u8981\u7684\u89c0\u5ff5<\/p>\n\n\n\n<p><strong>\u7e2e\u6392\u3001\u7e2e\u6392\u3001\u7e2e\u6392<\/strong><\/p>\n\n\n\n<p>\u4ee5\u5f8c\u5beb\u5225\u7a2e\u8a9e\u8a00\uff0c\u5305\u62ec C \uff0c\u5373\u4f7f\u7528\u4e86\u5927\u62ec\u865f\uff0c\u4e00\u6a23\u8981\u7e2e\u6392\uff0c<\/p>\n\n\n\n<p>\u4f60\u7684\u7a0b\u5f0f\u5beb\u5230\u8b93\u5225\u4eba\u5bb9\u6613\u95b1\u8b80\uff0c\u4f60\u5c31\u5bb9\u6613\u8b8a\u6210\u5927\u5496<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<div class=\"video-container\"><iframe loading=\"lazy\" title=\"\u3010\u8f49\u884c\u8edf\u9ad4\u5de5\u7a0b\u5e2b\u3011\u6211\u81ea\u5df1\u5f9e\u975e\u5c08\u696d\u80cc\u666f\u8f49\u578b\u6210\u70ba\u8edf\u9ad4\u5de5\u7a0b\u5e2b\u7684\u5fc3\u8def\u6b77\u7a0b\uff5c\u7d93\u9a57\u5206\u4eab\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/vJcMEojoGxY?feature=oembed&#038;wmode=opaque\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/div>\n<\/div><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n","protected":false},"excerpt":{"rendered":"<p>WebCam \u5982\u4f55\u6e2c\u8a66? \u5982\u4f55\u62cd\u7167\u6216\u9304\u5f71? \u64f7\u53d6\u4e00\u5f35\u6709\u4eba\u81c9\u7684\u5716\u7247 P&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":610,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/hower.forwebs.net\/robot\/wp-json\/wp\/v2\/posts\/556"}],"collection":[{"href":"https:\/\/hower.forwebs.net\/robot\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hower.forwebs.net\/robot\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hower.forwebs.net\/robot\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hower.forwebs.net\/robot\/wp-json\/wp\/v2\/comments?post=556"}],"version-history":[{"count":39,"href":"https:\/\/hower.forwebs.net\/robot\/wp-json\/wp\/v2\/posts\/556\/revisions"}],"predecessor-version":[{"id":614,"href":"https:\/\/hower.forwebs.net\/robot\/wp-json\/wp\/v2\/posts\/556\/revisions\/614"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hower.forwebs.net\/robot\/wp-json\/wp\/v2\/media\/610"}],"wp:attachment":[{"href":"https:\/\/hower.forwebs.net\/robot\/wp-json\/wp\/v2\/media?parent=556"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hower.forwebs.net\/robot\/wp-json\/wp\/v2\/categories?post=556"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hower.forwebs.net\/robot\/wp-json\/wp\/v2\/tags?post=556"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}