Upload frames from AWS DeepLens camera to slack

To do some basic testing on the AWS Deeplens camera, you can have it upload frames to slack. This example assumes you’ve set up SSH and you’ve logged in as “aws_cam”. For this, just run python directly – the camera unfortunately seems to be just set up with python2.

This sample requires two libraries, pypng, and slackclient:

pip2 install pypng --user
pip2 install slackclient --user

Then, get a slack token and set up a channel where you want to send the image – this example downsizes the image so you can see it directly in slack.

import png
import awscam
import cv2

ret, video_frame = awscam.getLastFrame()

resized = cv2.resize(video_frame, (len(video_frame[0])/8, len(video_frame)/8))
png.from_array(resized, 'RGB').save("frame.png")

from slackclient import SlackClient
sc = SlackClient('token')
sc.api_call('files.upload', channels='#video', filename='frame.png', file=open('frame.png', 'rb'))
0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *