element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
RIoTboard
  • Products
  • Dev Tools
  • Single-Board Computers
  • RIoTboard
  • More
  • Cancel
RIoTboard
Blog Simple Camera demo with Riotboard Yocto Gui & QT
  • Blog
  • Forum
  • Documents
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join RIoTboard to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: tusharp
  • Date Created: 25 Mar 2015 3:35 PM Date Created
  • Views 2966 views
  • Likes 3 likes
  • Comments 8 comments
  • tusharp
  • x11
  • yocto
  • cam8000-d
  • freescale
  • imx6
  • gst-launch
  • riotboard
  • embedded
  • qt
  • cortex-a9
  • camera
  • Gstreamer
  • yocto-gui
  • yocto-bsp
  • arm9
  • linux
Related
Recommended

Simple Camera demo with Riotboard Yocto Gui & QT

tusharp
tusharp
25 Mar 2015

In a previous blog series we have build u-boot, kernel and packages for  Riotboard using Yocto.

 

This time we shall use the Yocto Gui based BSP and QT to create a simple camera application.

 

Hardware Requirements:

1. RIoTboardRIoTboard

2. LCD8000-97CLCD8000-97C (LVDS) or HDMI

3. CAM8000-DCAM8000-D

 

I am using LVDS display for this guide, you can use HDMI.

make sure to change boot params accordingly.

 

Download the BSP from here , unzip it and flash to sdcard.

 

Now connect the cam8000-d module to Riotboard as shown below and boot the board.

8yggfd.jpg

 

 

Next we shall create an App using QT  to display images captured at regular intervals.

 

First download the qt binary webcam_demo.zip from attachment.

extract the binary from zip and copy to any location on sdcard (i copied to opt folder).

 

In the main window , click the List (Applications is present default) and Select All .

n4icr4.jpg

 

Next click on File Manager.

30df2bc.jpg

 

Select  Opt folder and click on webcam_demo

x3yvm.jpg

 

It will open a Window & display images captured from camera (with a refresh rate of few seconds).

15g6p2g.jpg

 

 

to capture a single snapshot (in terminal)

gst-launch mfw_v4lsrc device=/dev/video0 num-buffers=1 ! jpegenc ! filesink location=capture.jpg

 

 

The below QT code is used for this image display app.

#include <QApplication>

#include <QPushButton>

#include <QGraphicsScene>

#include <QtGui>

#include <QLabel>

#include <QPixmap>

#include <QThread>

#include <QTime>

#include <QProcess>

 

void delay( int millisecondsToWait )

{

    QTime dieTime = QTime::currentTime().addMSecs( millisecondsToWait );

    while( QTime::currentTime() < dieTime )

    {

        QCoreApplication::processEvents( QEventLoop::AllEvents, 100 );

    }

}

 

int main(int argc, char** argv)

{

    QApplication app(argc, argv);

    QProcess proc;

    QLabel screen;

 

    while(1)

    {

           QPixmap pixmap("/tmp/capture_old.jpg");

           screen.setPixmap(pixmap);

        screen.show();

        QProcess::execute ("gst-launch mfw_v4lsrc capture-mode=0 num-buffers=1 ! jpegenc ! filesink location=/tmp/capture.jpg");

        delay(1000);

        QProcess::execute ("cp /tmp/capture.jpg /tmp/capture_old.jpg");

    }

    return app.exec();

}

 

 

 

Before starting make sure to setup the compilation environment .

You can find more on yocto compiler setup here .

 

For compilation, use the attached source file webcam_demo.cpp.zip  .

 

 

Setting up directory.

mkdir webcam_demo

cd webcam_demo

 

download the yocto qt toolchain compiler from here.

 

convert it to executable.

chmod -R 777 poky-eglibc-i686-meta-toolchain-qt-cortexa9hf-vfp-neon-toolchain-qt-1.5.2.sh

 

Setting up compiler.

./poky-eglibc-i686-meta-toolchain-qt-cortexa9hf-vfp-neon-toolchain-qt-1.5.2.sh

Consider all defaults and proceed.

 

Setup environment:

source source /opt/poky/1.5.2/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi

 

build the app:

qmake -project

qmake

make

 

Now the binary is ready to be executed.

Attachments:
webcam_demo.zip
webcam_demo.cpp.zip
  • Sign in to reply
  • Former Member
    Former Member over 9 years ago in reply to tusharp

    Good  Tushar,

    Can you tell me how the QT deploys your application in the riotboard ? because i had a problem in the connection betwwen the qt creator and the riotboard please.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • tusharp
    tusharp over 10 years ago in reply to Former Member

    The HDMI works with this image.

     

    Snapshot from my LG HDMI monitor:

    image

     

     

    For me it does not. I got the same kernel freeze as reported here: Linux freezes when connected to HDMI

    Plz check my last comment on that Post.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Former Member
    Former Member over 10 years ago

    Are you sure that HDMI works with this image?

    For me it does not. I got the same kernel freeze as reported here: Linux freezes when connected to HDMI

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • tusharp
    tusharp over 10 years ago in reply to Former Member

    from terminal:

     

    VSALPHA=1 gst-launch filesrc location=capture.jpg ! jpegdec ! imagefreeze ! mfw_isink

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Former Member
    Former Member over 10 years ago

    Good Work Tushar,

        I am able to capture the image but there is no application to view the image. Can you tell me which application I have to install and how?

     

    Thanks

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube