We have moved to a new Sailfish OS Forum. Please start new discussions there.
2

get image from camera

asked 2016-05-23 14:27:49 +0300

MarkK gravatar image

updated 2018-12-03 21:40:51 +0300

Tanghus gravatar image

Hi, I would like to do something simple on my Jolla: set it up so it takes a picture every n seconds.

I'm a happy Jolla user and a semi-competent Linux scripter/programmer, but haven't programmed on Sailfish before.

So I'd like to write a script (or C++ program if I have to) to do this - but how do I get the camera to take a picture from (command line | scripting language | C++) ?

edit retag flag offensive close delete

Comments

Maybe you can find what you need at Finding Your Phone, the Linux Way

rgrnetalk ( 2016-05-23 15:03:33 +0300 )edit

2 Answers

Sort by » oldest newest most voted
3

answered 2016-05-23 19:44:36 +0300

Fuzzillogic gravatar image

As @coderus already said, QtMultimedia is your friend. Depending on your skills, QML might be even easier. Start a new QtQuick app in the Sailfish SDK. Replace the main QML file, the one with ApplicationWindow with:

import QtQuick 2.0
import Sailfish.Silica 1.0
import QtMultimedia 5.0

ApplicationWindow {
    Camera {
        id: camera
    }

    VideoOutput {
        source: camera
        anchors.fill: parent
    }

    Timer {
        interval: 5000
        running: true
        repeat: false
        onTriggered: camera.imageCapture.capture()
    }
}

This will take one photo after 5 seconds. You can find it in the gallery.

edit flag offensive delete publish link more

Comments

I think @MarkK wants to capture a timelapse, not a single picture. Or write a program which takes a picture and quits (this one doesn't, so it can't be called several times from the command line without killing it's process).
I've done something similar on a Raspberry Pi using a bash script set to run at boot. Taking timelapses on a Jolla could be more exiting as it has a battery (survives power outtakes, unlike my poor RPi) and you can fetch the images out of it wirelessly via sftp or sshfs.

jollailija ( 2016-05-25 13:57:54 +0300 )edit

Thanks, great suggestion. A program that takes a picture every n seconds and continues to do so until killed is fine. A program that takes a single picture then exits, also fine, I can wrap a shell script around that.

MarkK ( 2016-05-25 17:04:36 +0300 )edit

@MarkK, @jollailija I hoped the "repeat: false" was easy enough to understand. Anyway, set the repeat property of the Time to true, and it'll take pictures for as long as you leave the app running.

Fuzzillogic ( 2016-05-25 20:17:10 +0300 )edit
0

answered 2016-05-23 16:04:31 +0300

coderus gravatar image

you need to write some application utilizing QtMultimedia QCamera

edit flag offensive delete publish link more
Login/Signup to Answer

Question tools

Follow
2 followers

Stats

Asked: 2016-05-23 14:27:49 +0300

Seen: 925 times

Last updated: May 23 '16