{"id":611,"date":"2021-12-19T19:00:00","date_gmt":"2021-12-19T11:00:00","guid":{"rendered":"http:\/\/hower.forwebs.net\/robot\/?p=611"},"modified":"2021-12-20T11:30:28","modified_gmt":"2021-12-20T03:30:28","slug":"%e7%ac%ac13%e5%a0%82-%e6%a9%9f%e5%99%a8%e4%ba%ba%e8%a6%96%e8%a6%ba","status":"publish","type":"post","link":"https:\/\/hower.forwebs.net\/robot\/archives\/611","title":{"rendered":"\u7b2c13\u5802 \u6a5f\u5668\u4eba\u8996\u89ba-\u624b\u90e8\u8ffd\u8e64"},"content":{"rendered":"\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u671f\u672b\u4f5c\u696d\u8b1b\u89e3<\/p>\n\n\n\n<p>\u671f\u672b\u5404\u79d1\u7e41\u5fd9\uff0c\u4f5c\u696d\u8ab2\u5802\u4e0a\u505a\u5c31\u597d\uff0c\u5de5\u4f5c\u4e0d\u7528\u5e36\u56de\u5bb6\uff0c\u4f7f\u75282\u6a23\u4ee5\u4e0a\u7684\u88dd\u7f6e\u5373\u53ef\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\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=\"\u9069\u5408\u5152\u7ae5\u555f\u767cVR\u624b\u90e8\u8ffd\u8e64\u904a\u6232\u300aHand Physics Lab\uff1a\u624b\u7269\u7406\u5be6\u9a57\u5ba4\u300b\u7236\u6bcd\u4e0d\u7528\u518d\u8cb7\u89aa\u5b50\u684c\u904a\u7d66\u5c0f\u5b69\u4e86\uff1f\uff01\u53ef\u4ee5\u64ab\u6478\u5c0f\u8c93\u8c93FULL HAND TRACKING in Oculus Quest 2\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/LCFaKfCOiJ8?feature=oembed&#038;wmode=opaque\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/div>\n<\/div><figcaption>0~3:00<\/figcaption><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u5b89\u88dd  Visual Studio Code<\/p>\n\n\n\n<p>\u5b89\u88dd\u4e2d\u6587(\u9019\u6b21\u78ba\u5b9a\u90fd\u8f49\u6210\u4e2d\u6587)<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u5b89\u88ddpython\u652f\u63f4<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\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<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u5b89\u88dd MediaPipe<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip install mediapipe<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u6e2c\u8a66\u4e0a\u8ff0\u5b89\u88dd\u8207WebCAM<\/p>\n\n\n\n<p>python\u5c08\u6848\u5982\u4f55\u8a2d\u7f6e?<\/p>\n\n\n\n<p>1.\u5efa\u7acbOOO<\/p>\n\n\n\n<p>2.\u6253\u958bOOO<\/p>\n\n\n\n<p>3.\u65b0\u589e\u6a94\u6848<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u53c3\u8003\u7a0b\u5f0f<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import cv2\nimport mediapipe as mp\nimport time\n\ncap = cv2.VideoCapture(0)\nmpHands = mp.solutions.hands\nhands = mpHands.Hands(min_detection_confidence=0.5, min_tracking_confidence=0.5)\nmpDraw = mp.solutions.drawing_utils\nhandLmsStyle = mpDraw.DrawingSpec(color=(0, 0, 255), thickness=3)\nhandConStyle = mpDraw.DrawingSpec(color=(0, 255, 0), thickness=5)\npTime = 0\ncTime = 0\n\nwhile True:\n    ret, img = cap.read()\n    if ret:\n        imgRGB = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)\n        result = hands.process(imgRGB)\n\n        # print(result.multi_hand_landmarks)\n        imgHeight = img.shape&#91;0]\n        imgWidth = img.shape&#91;1]\n\n        if result.multi_hand_landmarks:\n            for handLms in result.multi_hand_landmarks:\n                mpDraw.draw_landmarks(img, handLms, mpHands.HAND_CONNECTIONS, handLmsStyle, handConStyle)\n                for i, lm in enumerate(handLms.landmark):\n                    xPos = int(lm.x * imgWidth)\n                    yPos = int(lm.y * imgHeight)\n\n                    # cv2.putText(img, str(i), (xPos-25, yPos+5), cv2.FONT_HERSHEY_SIMPLEX, 0.4, (0, 0, 255), 2)\n\n                    # if i == 4:\n                    #     cv2.circle(img, (xPos, yPos), 20, (166, 56, 56), cv2.FILLED)\n                    # print(i, xPos, yPos)\n\n        cTime = time.time()\n        fps = 1\/(cTime-pTime)\n        pTime = cTime\n        cv2.putText(img, f\"FPS : {int(fps)}\", (30, 50), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 0, 0), 3)\n\n        cv2.imshow('img', img)\n\n    if cv2.waitKey(1) == ord('q'):\n        break<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u622a\u5716<\/p>\n\n\n\n<p>\u87a2\u5e55\u9304\u5f71<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u5c0f\u6311\u6230<\/p>\n\n\n\n<p>\u628a\u7dda\u8ddf\u9ede\u6539\u984f\u8272\uff0c\u7c97\u7d30\u4e5f\u53ef\u4ee5\u6539<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u6307\u7bc0\u7de8\u865f<\/p>\n\n\n\n<p>\u5f37\u8abf\u5927\u62c7\u6307<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u6539\u6210\u98df\u6307\u6307\u5c16<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\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=\"\u624b\u6a5f\u4e5f\u80fd1\u79d2\u8b8a\u8eab\u5065\u8eab\u74b0\uff1f\u9ad4\u611f\u904a\u6232App\u8b93\u4ed6\u76f4\u547c\u592a\u7d2f\u4e86\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/x4tp9Dh1pz8?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>\u4eca\u5929\u4f5c\u696d<\/p>\n\n\n\n<p>\u60f3\u50cf\u4e00\u500b\u624b\u90e8\u8ffd\u8e64\u53ef\u4ee5\u61c9\u7528\u7684\u65b9\u5f0f\u3002\u7528\u5728\u65e5\u5e38\u751f\u6d3b\u3001\u904a\u6232\u3001\u5b78\u7fd2\u90fd\u53ef\u4ee5\uff0c\u8acb\u958b\u653e\u81ea\u7531\u7684\u60f3\u50cf\uff0c\u4e0d\u7528\u771f\u7684\u505a\u51fa\u4f86\uff0c\u4e5f\u4e0d\u8981\u60f3\u592a\u591a\u6280\u8853\u4e0a\u7684\u9650\u5236\u3002<\/p>\n\n\n\n<p>\u56de\u7b54\u5728Classroom\u7684\u4f5c\u696d\u4e0a\uff0c\u7c21\u55ae\u5c31\u597d\uff0c\u4e0b\u8ab2\u524d\u4ea4\uff0c\u4e0d\u7528\u5e36\u56de\u5bb6\u4f5c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u671f\u672b\u4f5c\u696d\u8b1b\u89e3 \u671f\u672b\u5404\u79d1\u7e41\u5fd9\uff0c\u4f5c\u696d\u8ab2\u5802\u4e0a\u505a\u5c31\u597d\uff0c\u5de5\u4f5c\u4e0d\u7528\u5e36\u56de\u5bb6\uff0c\u4f7f\u75282&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":625,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/hower.forwebs.net\/robot\/wp-json\/wp\/v2\/posts\/611"}],"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=611"}],"version-history":[{"count":19,"href":"https:\/\/hower.forwebs.net\/robot\/wp-json\/wp\/v2\/posts\/611\/revisions"}],"predecessor-version":[{"id":640,"href":"https:\/\/hower.forwebs.net\/robot\/wp-json\/wp\/v2\/posts\/611\/revisions\/640"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hower.forwebs.net\/robot\/wp-json\/wp\/v2\/media\/625"}],"wp:attachment":[{"href":"https:\/\/hower.forwebs.net\/robot\/wp-json\/wp\/v2\/media?parent=611"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hower.forwebs.net\/robot\/wp-json\/wp\/v2\/categories?post=611"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hower.forwebs.net\/robot\/wp-json\/wp\/v2\/tags?post=611"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}