{"id":4306,"date":"2020-10-09T18:00:19","date_gmt":"2020-10-09T09:00:19","guid":{"rendered":"https:\/\/taki-lab.site\/bocci\/?p=4306"},"modified":"2020-10-09T15:25:06","modified_gmt":"2020-10-09T06:25:06","slug":"%e3%80%90%e3%83%a9%e3%82%ba%e3%83%91%e3%82%a4%e3%80%91%e3%80%90%e3%82%ab%e3%83%a1%e3%83%a9%e3%80%91%e3%83%97%e3%83%ac%e3%83%93%e3%83%a5%e3%83%bc%e7%94%bb%e9%9d%a2%e3%82%92%e3%83%a9%e3%82%ba%e3%83%91-2","status":"publish","type":"post","link":"https:\/\/taki-lab.site\/bocci\/?p=4306","title":{"rendered":"\u3010\u30e9\u30ba\u30d1\u30a4\u3011\u3010\u30ab\u30e1\u30e9\u3011\u30d7\u30ec\u30d3\u30e5\u30fc\u753b\u9762\u3092\u30e9\u30ba\u30d1\u30a4\u304b\u3089\u53d6\u5f97\u30fb\u8868\u793a(\u4fee\u6b63)"},"content":{"rendered":"\n<figure class=\"wp-block-embed-wordpress wp-block-embed is-type-wp-embed is-provider-\u81ea\u5206\u3001\u307c\u3063\u3061\u3067\u3059\u304c\u4f55\u304b\uff1f\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"2BowF412Pc\"><a href=\"https:\/\/taki-lab.site\/bocci\/?p=4284\">\u3010\u30e9\u30ba\u30d1\u30a4\u3011\u3010\u30ab\u30e1\u30e9\u3011\u30d7\u30ec\u30d3\u30e5\u30fc\u753b\u9762\u3092\u30e9\u30ba\u30d1\u30a4\u304b\u3089\u53d6\u5f97\u30fb\u8868\u793a<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;\u3010\u30e9\u30ba\u30d1\u30a4\u3011\u3010\u30ab\u30e1\u30e9\u3011\u30d7\u30ec\u30d3\u30e5\u30fc\u753b\u9762\u3092\u30e9\u30ba\u30d1\u30a4\u304b\u3089\u53d6\u5f97\u30fb\u8868\u793a&#8221; &#8212; \u81ea\u5206\u3001\u307c\u3063\u3061\u3067\u3059\u304c\u4f55\u304b\uff1f\" src=\"https:\/\/taki-lab.site\/bocci\/?p=4284&#038;embed=true#?secret=ynlHk25gKi#?secret=2BowF412Pc\" data-secret=\"2BowF412Pc\" width=\"474\" height=\"267\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>\u3053\u306e\u8a18\u4e8b\u306e\u30bd\u30fc\u30b9\u304c\u4f59\u308a\u306b\u3082\u5197\u9577\u3059\u304e\u308b\u306e\u3067\u3001\u66f8\u304d\u63db\u3048\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u3053\u3093\u306a\u611f\u3058\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CONTENT_TYPE = {'.html': 'text\/html; charset=utf-8', '.txt': 'text\/plain; charset=utf-8', '.js': 'text\/javascript', '.json': 'application\/json',\r\n        '.jpeg': 'image\/jpeg', '.jpg': 'image\/jpeg', '.png': 'image\/png', '.gif': 'image\/gif',\r\n        '.css':'text\/css'}\n\n\n\n    def do_GET(self):\r\n        parsed = urlparse(self.path)\r\n        if parsed.path == '\/Streaming':\r\n            enc = sys.getfilesystemencoding()\r\n\r\n            _, img = cap.read()\r\n            resized_img = cv2.resize(img, (480, 320))\r\n            _, encoded_img = cv2.imencode('.jpg', resized_img, &#91;int(cv2.IMWRITE_JPEG_QUALITY), 30])\r\n            dst_base64 = base64.b64encode(encoded_img).decode('utf-8')\r\n\r\n            data = {\r\n                'image': 'data:image\/jpg;base64,' + dst_base64\r\n            }\r\n\r\n            encoded = json.dumps(data).encode()\r\n\r\n            self.send_response(HTTPStatus.OK)\r\n            self.send_header(\"Content-type\", \"text\/html; charset=%s\" % enc)\r\n            self.send_header(\"Access-Control-Allow-Origin\", \"null\")\r\n            self.send_header(\"Content-Length\", str(len(encoded)))\r\n            self.end_headers()\r\n\r\n            self.wfile.write(encoded)\r\n        elif parsed.path.endswith('\/'):\r\n            self.send_response(HTTPStatus.OK)\r\n            with open('index.html',mode='br') as f:\r\n                data = f.read()\r\n            self.send_header(\"Content-type\", \"text\/html; charset=utf-8\")\r\n            self.end_headers()\r\n            self.wfile.write(bytes(data))\r\n        else:\r\n            self.send_response(HTTPStatus.OK)\r\n            filepath = '.' + parsed.path\r\n            with open(filepath, mode='br') as f:\r\n                data = f.read()\r\n            self.send_header(\"Content-type\", CONTENT_TYPE&#91;pathlib.Path(filepath).suffix])\r\n            self.end_headers()\r\n            self.wfile.write(bytes(data))\r\n<\/code><\/pre>\n\n\n\n<p>\u307e\u305a\u3001URL\u304c&#8221;\/&#8221;\u306e\u5834\u5408\u306findex.html\u3092\u8fd4\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u305d\u3057\u3066\u3001URL\u304c&#8221;\/Streaming&#8221;\u306e\u5834\u5408\u306f\u30ab\u30e1\u30e9\u306e\u6620\u50cf\u3092base64\u3067\u8fd4\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u305d\u308c\u4ee5\u5916\u306e\u5834\u5408(\u4eca\u56de\u3067\u8a00\u3046\u3068\u3001js\u30d5\u30a1\u30a4\u30eb\u9054)\u3001URL\u3067\u6307\u5b9a\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u540d\u3068\u540c\u3058\u30d5\u30a1\u30a4\u30eb\u3092\u8fd4\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u305f\u3060\u3001\u305d\u306e\u5834\u5408\u3001content-type\u3092\u6b63\u3057\u3044\u3082\u306e\u306b\u3057\u306a\u3044\u3068\u30d6\u30e9\u30a6\u30b6\u304c\u6b63\u3057\u304f\u52d5\u3044\u3066\u304f\u308c\u306a\u3044\u306e\u3067\u3001\u30d5\u30a1\u30a4\u30eb\u62e1\u5f35\u5b50\u306b\u5bfe\u5fdc\u3059\u308b\u9069\u5207\u306acontent-type\u3092\u8a2d\u5b9a\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u305d\u308c\u3092\u5bfe\u5fdc\u3065\u3051\u3066\u3044\u308b\u306e\u304cCONTENT_TYPE\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3053\u3046\u3059\u308b\u3053\u3068\u3067\u3001\u4eca\u5f8cjs\u30d5\u30a1\u30a4\u30eb\u4ee5\u5916\u306e\u3082\u306e\u306b\u3082\u5bfe\u5fdc\u51fa\u6765\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u4e00\u822c\u7684\u306aHTTP\u30b5\u30fc\u30d0\u306b\u6bd4\u3079\u308c\u3070\u4e0d\u5341\u5206\u3067\u3059\u304c\u3001\u4eca\u56de\u76ee\u6307\u3057\u3066\u3044\u308b\u306e\u306f\u305d\u308c\u3067\u306f\u306a\u3044\u306e\u3067\u3001\u3053\u3093\u306a\u3082\u3093\u3067\u5341\u5206\u3067\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<p>\u30bd\u30fc\u30b9\u306fgitHub\u306b\u516c\u958b\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/takishita2nd\/RemoteCamera\">https:\/\/github.com\/takishita2nd\/RemoteCamera<\/a><\/p>\n\n\n\n<a href=\"\/\/blog.with2.net\/link\/?2023426:1010\" target=\"_blank\" rel=\"noopener noreferrer\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/taki-lab.site\/bocci\/wp-content\/uploads\/2019\/12\/03a6eee54039f74ded0b8f7548b1868f.png?w=474\" title=\"\u30d1\u30bd\u30b3\u30f3\u30e9\u30f3\u30ad\u30f3\u30b0\"><\/a>\n\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u306e\u8a18\u4e8b\u306e\u30bd\u30fc\u30b9\u304c\u4f59\u308a\u306b\u3082\u5197\u9577\u3059\u304e\u308b\u306e\u3067\u3001\u66f8\u304d\u63db\u3048\u307e\u3057\u305f\u3002 \u3053\u3093\u306a\u611f\u3058\u3067\u3059\u3002 \u307e\u305a\u3001URL\u304c&#8221;\/&#8221;\u306e\u5834\u5408\u306findex.html\u3092\u8fd4\u3057\u307e\u3059\u3002 \u305d\u3057\u3066\u3001URL\u304c&#8221;\/Streaming&#038;#8 &hellip; <a href=\"https:\/\/taki-lab.site\/bocci\/?p=4306\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">\u3010\u30e9\u30ba\u30d1\u30a4\u3011\u3010\u30ab\u30e1\u30e9\u3011\u30d7\u30ec\u30d3\u30e5\u30fc\u753b\u9762\u3092\u30e9\u30ba\u30d1\u30a4\u304b\u3089\u53d6\u5f97\u30fb\u8868\u793a(\u4fee\u6b63)<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"\u3010\u30e9\u30ba\u30d1\u30a4\u3011\u3010\u30ab\u30e1\u30e9\u3011\u30d7\u30ec\u30d3\u30e5\u30fc\u753b\u9762\u3092\u30e9\u30ba\u30d1\u30a4\u304b\u3089\u53d6\u5f97\u30fb\u8868\u793a(\u4fee\u6b63)\n#TechCommit\n","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[187,3],"tags":[188],"class_list":["post-4306","post","type-post","status-publish","format-standard","hentry","category-raspberry-pi","category-3","tag-188"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8SDbY-17s","jetpack-related-posts":[{"id":4412,"url":"https:\/\/taki-lab.site\/bocci\/?p=4412","url_meta":{"origin":4306,"position":0},"title":"\u3010\u30e9\u30ba\u30d1\u30a4\u3011\u3010\u30ab\u30e1\u30e9\u3011WEB\u304b\u3089\u52d5\u753b\u3092\u64ae\u5f71\u3059\u308b\u3002","author":"taki","date":"2020\u5e7410\u670822\u65e5","format":false,"excerpt":"\u4eca\u56de\u306fWeb\u306e\u30d7\u30ec\u30d3\u30e5\u30fc\u753b\u9762\u304b\u3089\u52d5\u753b\u306e\u64ae\u5f71\u3092\u884c\u3044\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002 \u8d64\u4e38\u306e\u30dc\u30bf\u30f3\u3092\u8a2d\u7f6e\u3057\u3001\u62bc\u3059\u3068\u9332\u753b\u958b\u2026","rel":"","context":"Raspberry Pi","block_context":{"text":"Raspberry Pi","link":"https:\/\/taki-lab.site\/bocci\/?cat=187"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/taki-lab.site\/bocci\/wp-content\/uploads\/2020\/10\/409b9c673c58e088d0e33e05cc17ab2e.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/taki-lab.site\/bocci\/wp-content\/uploads\/2020\/10\/409b9c673c58e088d0e33e05cc17ab2e.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/taki-lab.site\/bocci\/wp-content\/uploads\/2020\/10\/409b9c673c58e088d0e33e05cc17ab2e.jpg?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":4284,"url":"https:\/\/taki-lab.site\/bocci\/?p=4284","url_meta":{"origin":4306,"position":1},"title":"\u3010\u30e9\u30ba\u30d1\u30a4\u3011\u3010\u30ab\u30e1\u30e9\u3011\u30d7\u30ec\u30d3\u30e5\u30fc\u753b\u9762\u3092\u30e9\u30ba\u30d1\u30a4\u304b\u3089\u53d6\u5f97\u30fb\u8868\u793a","author":"taki","date":"2020\u5e7410\u67088\u65e5","format":false,"excerpt":"https:\/\/taki-lab.site\/bocci\/?p=4223 \u524d\u56de\u306f\u3001Web\u30da\u30fc\u30b8\u3092\u30ed\u30fc\u30ab\u2026","rel":"","context":"Raspberry Pi","block_context":{"text":"Raspberry Pi","link":"https:\/\/taki-lab.site\/bocci\/?cat=187"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/taki-lab.site\/bocci\/wp-content\/uploads\/2020\/10\/f47d4a87b363eb18d947d09176fed1ff.jpg?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/taki-lab.site\/bocci\/wp-content\/uploads\/2020\/10\/f47d4a87b363eb18d947d09176fed1ff.jpg?resize=350%2C200 1x, https:\/\/i0.wp.com\/taki-lab.site\/bocci\/wp-content\/uploads\/2020\/10\/f47d4a87b363eb18d947d09176fed1ff.jpg?resize=525%2C300 1.5x"},"classes":[]},{"id":4223,"url":"https:\/\/taki-lab.site\/bocci\/?p=4223","url_meta":{"origin":4306,"position":2},"title":"\u3010\u30e9\u30ba\u30d1\u30a4\u3011\u30ea\u30e2\u30fc\u30c8\u3067\u30ab\u30e1\u30e9\u306e\u30d7\u30ec\u30d3\u30e5\u30fc\u8868\u793a","author":"taki","date":"2020\u5e7410\u67081\u65e5","format":false,"excerpt":"\u3044\u3084\u3001\u4eca\u56de\u306f\u7d50\u69cb\u30cf\u30de\u3063\u305f\u3002 \u3053\u308c\u304c\u534a\u65e5\u9811\u5f35\u3063\u305f\u6210\u679c\u3060\u3002 \u307e\u305a\u306f\u30e9\u30ba\u30d1\u30a4\u5074\u3002 import base6\u2026","rel":"","context":"Raspberry Pi","block_context":{"text":"Raspberry Pi","link":"https:\/\/taki-lab.site\/bocci\/?cat=187"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/taki-lab.site\/bocci\/wp-content\/uploads\/2020\/10\/795a241f54d363e98d9ebe27e7b4d0df.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":4348,"url":"https:\/\/taki-lab.site\/bocci\/?p=4348","url_meta":{"origin":4306,"position":3},"title":"\u3010\u30e9\u30ba\u30d1\u30a4\u3011\u3010\u30ab\u30e1\u30e9\u3011Web\u304b\u3089\u30ab\u30e1\u30e9\u306e\u753b\u50cf\u3092\u4fdd\u5b58\u3059\u308b\u3002","author":"taki","date":"2020\u5e7410\u670815\u65e5","format":false,"excerpt":"https:\/\/taki-lab.site\/bocci\/?p=4306 \u524d\u56de\u306f\u30ab\u30e1\u30e9\u306e\u30d7\u30ec\u30d3\u30e5\u30fc\u753b\u9762\u2026","rel":"","context":"Raspberry Pi","block_context":{"text":"Raspberry Pi","link":"https:\/\/taki-lab.site\/bocci\/?cat=187"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/taki-lab.site\/bocci\/wp-content\/uploads\/2020\/10\/ad033887f992ecb8421d376c24691460.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/taki-lab.site\/bocci\/wp-content\/uploads\/2020\/10\/ad033887f992ecb8421d376c24691460.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/taki-lab.site\/bocci\/wp-content\/uploads\/2020\/10\/ad033887f992ecb8421d376c24691460.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/taki-lab.site\/bocci\/wp-content\/uploads\/2020\/10\/ad033887f992ecb8421d376c24691460.jpg?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":4807,"url":"https:\/\/taki-lab.site\/bocci\/?p=4807","url_meta":{"origin":4306,"position":4},"title":"\u3010\u30e9\u30ba\u30d1\u30a4\u3011WebAPI\u3067\u8d64\u5916\u7dda\u4fe1\u53f7\u3092\u9001\u4fe1\u3059\u308b","author":"taki","date":"2020\u5e7412\u670829\u65e5","format":false,"excerpt":"https:\/\/taki-lab.site\/bocci\/?p=4683 https:\/\/taki-l\u2026","rel":"","context":"Raspberry Pi","block_context":{"text":"Raspberry Pi","link":"https:\/\/taki-lab.site\/bocci\/?cat=187"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/taki-lab.site\/bocci\/wp-content\/uploads\/2020\/12\/400b0ecc87fec1d57113db5b776b785c.jpg?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/taki-lab.site\/bocci\/wp-content\/uploads\/2020\/12\/400b0ecc87fec1d57113db5b776b785c.jpg?resize=350%2C200 1x, https:\/\/i0.wp.com\/taki-lab.site\/bocci\/wp-content\/uploads\/2020\/12\/400b0ecc87fec1d57113db5b776b785c.jpg?resize=525%2C300 1.5x, https:\/\/i0.wp.com\/taki-lab.site\/bocci\/wp-content\/uploads\/2020\/12\/400b0ecc87fec1d57113db5b776b785c.jpg?resize=700%2C400 2x"},"classes":[]},{"id":4024,"url":"https:\/\/taki-lab.site\/bocci\/?p=4024","url_meta":{"origin":4306,"position":5},"title":"\u3010\u30e9\u30ba\u30d1\u30a4\u3011\u3010\u3044\u308d\u3044\u308d\u8a08\u6e2c\u30e2\u30cb\u30bf\u30fc\u3011Windows\u5074\u304b\u3089\u3082\u64cd\u4f5c\u3057\u3061\u3083\u3046","author":"taki","date":"2020\u5e749\u67083\u65e5","format":false,"excerpt":"\u524d\u56de\u307e\u3067\u306e\u72b6\u6cc1\u306f\u3053\u3061\u3089\u3002 https:\/\/taki-lab.site\/bocci\/?p=3978 \u6700\u2026","rel":"","context":"Raspberry Pi","block_context":{"text":"Raspberry Pi","link":"https:\/\/taki-lab.site\/bocci\/?cat=187"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_likes_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/taki-lab.site\/bocci\/index.php?rest_route=\/wp\/v2\/posts\/4306","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/taki-lab.site\/bocci\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/taki-lab.site\/bocci\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/taki-lab.site\/bocci\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/taki-lab.site\/bocci\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4306"}],"version-history":[{"count":1,"href":"https:\/\/taki-lab.site\/bocci\/index.php?rest_route=\/wp\/v2\/posts\/4306\/revisions"}],"predecessor-version":[{"id":4307,"href":"https:\/\/taki-lab.site\/bocci\/index.php?rest_route=\/wp\/v2\/posts\/4306\/revisions\/4307"}],"wp:attachment":[{"href":"https:\/\/taki-lab.site\/bocci\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4306"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/taki-lab.site\/bocci\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4306"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/taki-lab.site\/bocci\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4306"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}