Lights, Camera, Action!
This month we enabled camera support in the Mark II OS and released our first Camera Skill thanks to @AIIX, so developers using a Dev Kit can start using it immediately.
There are currently two modes – taking single shot photographs; and using the camera app.
“Hey Mycroft, take a selfie”
The single shot photo mode is perfect for a quick selfie or photograph. It shows a live view of the camera feed, counts down from 5, takes the photo, and saves it in your device’s Pictures directory.
“Hey Mycroft, open the camera app”
The Camera app gives you more time to frame your photo, and adds a zoom slider so you can get a nice close up shot. When you’re ready, tell Mycroft to take the photo or tap the shutter button on screen.
Mark II Dev Kit Camera Module
The camera module in the Mark II Dev Kit is a 5MP camera capable of 2592 x 1944 pixel static images, and video at 1080p30, 720p60 and 640x480p60/90. Currently, it is software limited to low-resolution while we ensure that higher resolution images won’t cause issues with memory allocations.
Skill API
The Camera Skill is also a great example of using the new Skill API when developing your own Skills.
Imagine: for your next Skill you want to let the user add a profile picture by taking a selfie. Rather than implementing your own camera functionality, you can let the Camera Skill take care of that for you through it’s publicly declared API.
There are currently two methods exposed on the Camera Skill’s API.
take_single_photo()
open_camera_app()
To use either of these in a new Skill requires just 3 lines of code.
First we import the SkillApi class:
from mycroft.skills.api import SkillApi
Then we get the correct API based off the Skill ID:
camera = SkillApi.get(‘skill-camera.mycroftai’)
Finally, we can call any method that is made available by that Skill:
camera.take_single_photo()
We’ll cover the new Skill API in more detail in an upcoming post, but if you want to try it out today checkout the Skill API documentation.
Gez is the Director of Developer Relations at Mycroft. He comes from the land down under, has a strange love of crocodiles, and one day hopes to play the ukulele. If he’s not hanging out in our Community Chat and Forums, he is probably getting lost in the bush.