{"id":5730,"date":"2018-06-01T13:58:58","date_gmt":"2018-06-01T13:58:58","guid":{"rendered":"http:\/\/www.garysieling.com\/blog\/?p=5730"},"modified":"2020-03-30T02:31:13","modified_gmt":"2020-03-30T02:31:13","slug":"upload-frames-aws-deeplens-camera-slack","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/upload-frames-aws-deeplens-camera-slack\/","title":{"rendered":"Upload frames from AWS DeepLens camera to slack"},"content":{"rendered":"<p>To do some basic testing on the <a href=\"https:\/\/amzn.to\/2H8FGWQ\">AWS Deeplens camera<\/a>, you can have it upload frames to slack. This example assumes you&#8217;ve set up SSH and you&#8217;ve logged in as &#8220;aws_cam&#8221;. For this, just run python directly &#8211; the camera unfortunately seems to be just set up with python2.<\/p>\n<p>This sample requires two libraries, pypng, and slackclient:<\/p>\n<pre>pip2 install pypng --user\npip2 install slackclient --user\n<\/pre>\n<p>Then, get a slack token and set up a channel where you want to send the image &#8211; this example downsizes the image so you can see it directly in slack.<\/p>\n<pre lang\"python\"=\"\">import png\nimport awscam\nimport cv2\n\nret, video_frame = awscam.getLastFrame()\n\nresized = cv2.resize(video_frame, (len(video_frame[0])\/8, len(video_frame)\/8))\npng.from_array(resized, 'RGB').save(\"frame.png\")\n\nfrom slackclient import SlackClient\nsc = SlackClient('token')\nsc.api_call('files.upload', channels='#video', filename='frame.png', file=open('frame.png', 'rb'))\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Send an image from the AWS Deeplens to Slack<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[4,8],"tags":[72,447],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/5730"}],"collection":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/comments?post=5730"}],"version-history":[{"count":1,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/5730\/revisions"}],"predecessor-version":[{"id":6434,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/5730\/revisions\/6434"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=5730"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=5730"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=5730"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}