SlideShare a Scribd company logo
[Part 1] automation of home appliances using raspberry pi – software installation guide
Intro
At Azilen, we believe in creating smart solutions for an interconnected and
intelligent world. With emergence of IoT we try to achieve advanced connectivity
and ensure efficiency through connected devices and network sensors.
Our recent work on the automation of home appliances through gesture
recognition is one such example where we aim to control and automate home
appliances such as air conditioners and televisions. We have achieved gesture
recognition for implementing functionality like Turning On-Off, Increasing and
decreasing the temperature for Air-conditioner and Turning On-Off for Television.
Through an extensive research, our team explored various feasible options for
selecting the right platform and suitable libraries to make real time computer vision
possible for gesture recognition. From Omega ,Chip, Aurduino ,Raspberry Pi
amongst the platform and from BoofCV, OpenIMAJ, MATLAB, OpenCV and JavaCV
among the libraries, the team selected Raspberry Pi and leading open source library
”Open CV” and its java port “JavaCV” as the right platform to make computer vision
and image processing possible.
The library has more than 2500 optimized algorithms, which includes a
comprehensive set of both classic and state-of-the-art computer vision and
machine learning algorithms. These algorithms can be used to detect and recognize
faces, identify objects, classify human actions in videos, track camera movements,
track moving objects, etc.
This blog talks about the complete step by step guide to setup OpenCV and JavaCV
on Raspberry Pi.
Step by Step Guide to Setup OpenCV and JavaCV on
Raspberry Pi
Note:
We assume that you have pre-installed latest Raspbian operating system on
your Raspberry-Pi. If not please follow this link to install latest Raspbian on
your Raspberry-Pi.
https://www.raspberrypi.org/downloads/noobs/
Installation Guide: Step-1: Update Raspbian
Please follow below steps to setup OpenCV and JavaCV on Raspberry Pi
Step-1: Update Raspbian
At the start you need compiler tools so update and upgrade the Raspberry Pi
(Raspbian Linux) with latest available packages
Get all the compiler tools and video libraries using the below commands:
Open the terminal window and fire following commands one by one
1 sudo apt-get update
2 sudo apt-get upgrade
Step-2: Install Dependencies
– Open CV requires few external dependencies for it to be able to run,
therefore you need to install all the required dependencies in the following
order:
Open the terminal window and fire following commands one by one
[Part 1] automation of home appliances using raspberry pi – software installation guide
Note:
If some of the libraries fail to download, then try to look for a different
version of the library using apt-cache search as some of these libraries are not
in Raspbian repository anymore or are available with newer versions
For e.g. :
1 sudo apt-cache search ffmpeg
Step 3: Download OpenCV Source Code and Install
Now we have our dependencies installed, let’s grab the OpenCV archive version
2.4.13 from the official OpenCV repository.
(Note: As future versions of OpenCV are released, you can replace 3.1.0, 3.2.0
with the latest version number, but this guide is focused around version 2.4.13).
wget https://sourceforge.net/projects/OpenCVlibrary/files/OpenCV-
unix/2.4.13/OpenCV-2.4.13.zip/download
Uncompress the downloaded source file
Move into uncompressed directore and create a new directory named “release”
inside it
Run below commands to configure, compile and install OpenCV.Please note
that compilation will take approximately 4-5 hours, so grab yourself a nice pizza
and relax !
1 cmake -D CMAKE_BUILD_TYPE=RELEASE -D
CMAKE_INSTALL_PREFIX=/usr/local ..
2 make
3 sudo make install
4 sudo idconfig
After cmake is done successfully, the jar file will be under release/bin/ and
release/lib/ folder. Since we build version 2.4.13, the generated file will be
named OpenCV-2413.jar and libOpenCV_java.so.
Both generated files will required in build path for any java based project with
OpenCV. While libOpenCV_java.so is required for any C/C++ based project
with OpenCV.
Note: If you get any Linker error or java.library.path issue ,you need to
provide path for generated OpenCV jar file with java -jar cmd. using –
Djava.library.path= ‘path to OpenCV libs’ or you can export
LD_LIBRARY_PATH system variable with lib path. you can also add export
command to .bashcr file as well
Step 4 : Compile JavaCV / javaCPP
Now that we have compiled and installed OpenCV 2.4.13 on our Raspberry
Pi, we can compile and install JavaCV and JavaCPP on Raspberry Pi. In order
to do that, you need to have Java, Maven and Git installed on the Raspberry
Pi.
The compilation of JavaCV and javaCPP does not run with all versions of Java
(such as Oracle JDK 8). It runs correctly with OpenJDK 7 which needs to be
installed temporarily for this purpose if it’s not already installed. There might
be multiple versions of Java installed. It needs to be ensured that OpenJDK 7
is the default selected Java version. Please run following commands on your
terminal window to install OpenJDK.
Install OpenJDK 7 and select OpenJDK 7 as default Java version:
1 sudo apt-get install openjdk-7-jdk
2 sudo update-alternatives --config java
3 sudo update-alternatives --config javac
For JavaCV / javaCPP Maven is needed. The source will be downloaded using
Git.
Once the source is downloded reset the sources to the old version 0.7 of
JavaCV and javaCPP as they are the recent working ones for our purpose. Two
modifications to the source files need to be performed to run on the
Raspberry Pi and these will be done with a sed command. Afterwards the
compilation can be started.
Run the following commands in terminal window: (Follow steps in order)
[Part 1] automation of home appliances using raspberry pi – software installation guide
And that’s it. You have successfully installed JavaCV/JavaCPP on Raspberry Pi.
Next step is to verify your installation.
Step 5: Testing your OpenCV / JavaCV Installation
Open your favorite editor on Raspberry Pi (VI/NANO/PageLeaf).
Create a new java file as shown below and save the file.
• Note: Raspbian ships latest Oracle JDK version with it. Please use
command ‘whereis java’ to find out the location of the Oracle JDK and
make it default java version now onwards.
Now compile this file using Oracle JDK version >= 7. Type following
commands into your terminal to compile and run this java code.
1 javac –cp ‘path to generated JavaCV-2.4.13.jar’
JavaCVTest.java
2 java –cp ‘path to generated JavaCV-2.4.13.jar’ –
Djava.library.path=’path to generated OpenCV-2.4.13.so’
JavaCVTest
The java code output must be as below:
Congrats! You have a brand new, fresh install of OpenCV / JavaCV on your
Raspberry Pi. And I’m sure you’re just itching to leverage your Raspberry Pi to
build some awesome computer vision apps.
Conclusion
Our comprehensive approach can help implement various IoT solutions such
as color detection, face recognition system, motion tracking, Object
identification and Mobile robotics.
So, what’s next?
In our upcoming blog we aim to write about complete guide for automating
air conditioner and television appliances for implementing features through
gesture recognition.
Original Source :
http://www.azilen.com/blog/automation-of-home-appliances-using-
raspberry-pi-part-1/
Thanks You
www.azilen.com
Let us know if you have any Question!
info@azilen.com | +1-972-325-2243

More Related Content

PDF
Console Apps: php artisan forthe:win
PPTX
PHP Dependency Management with Composer
PDF
Laravel Forge: Hello World to Hello Production
PDF
Laravel Code Generators and Packages
PPTX
Composer | PHP Dependency Manager
PDF
Server(less) Swift at SwiftCloudWorkshop 3
PDF
Seven perilous pitfalls to avoid with Java | DevNation Tech Talk
PPSX
Setting advanced PHP development environment
Console Apps: php artisan forthe:win
PHP Dependency Management with Composer
Laravel Forge: Hello World to Hello Production
Laravel Code Generators and Packages
Composer | PHP Dependency Manager
Server(less) Swift at SwiftCloudWorkshop 3
Seven perilous pitfalls to avoid with Java | DevNation Tech Talk
Setting advanced PHP development environment

What's hot (20)

DOCX
Integrating tomcat with apache
KEY
Perlbrew
PDF
perlbrew yapcasia 2010
PPTX
DevOps hackathon Session 2: Basics of Chef
PDF
Maven 3.0 at Øredev
PDF
composer_talk_20160209
PDF
Os Leventhal
KEY
Single Sourcing RCP and RAP
PPTX
Vagrant to-aws-flow
ODP
Presentation laravel 5 4
PPT
Get ready for FRC 2015: Intro to Java 5 through 8 updates and Eclipse
PDF
Deploying Symfony | symfony.cat
PPTX
Introduction to Laravel Framework (5.2)
PDF
Adventures in Laravel 5 SunshinePHP 2016 Tutorial
PDF
Working with Xcode and Swift Package Manager
PDF
JavaCro'15 - Beyond the basics of SonarQube improve your Java(Script) code ev...
PDF
Cocoapods Overview - library dependency manager for iOS
KEY
Pinto+Stratopan+Love
PDF
Why Laravel?
PDF
MyCPAN (Frozen Perl 2008 Lightning Talk)
Integrating tomcat with apache
Perlbrew
perlbrew yapcasia 2010
DevOps hackathon Session 2: Basics of Chef
Maven 3.0 at Øredev
composer_talk_20160209
Os Leventhal
Single Sourcing RCP and RAP
Vagrant to-aws-flow
Presentation laravel 5 4
Get ready for FRC 2015: Intro to Java 5 through 8 updates and Eclipse
Deploying Symfony | symfony.cat
Introduction to Laravel Framework (5.2)
Adventures in Laravel 5 SunshinePHP 2016 Tutorial
Working with Xcode and Swift Package Manager
JavaCro'15 - Beyond the basics of SonarQube improve your Java(Script) code ev...
Cocoapods Overview - library dependency manager for iOS
Pinto+Stratopan+Love
Why Laravel?
MyCPAN (Frozen Perl 2008 Lightning Talk)
Ad

Similar to [Part 1] automation of home appliances using raspberry pi – software installation guide (20)

PDF
openCV and Java - Face Detection
PDF
OpenSCAP Overview(security scanning for docker image and container)
DOCX
Introduction to java programming tutorial
ODP
Setting up and open fidy dev environment
PPTX
B wapp – bee bug – installation
PPTX
Java Device I/O at Raspberry PI to Build a Candy Vending Machine
PDF
AWS EC2 Ubuntu Instance - Step-by-Step Deployment Guide
PPT
Maven Introduction
ODP
Raspberry pi performace and program by open cv
PDF
PVS-Studio in the Clouds: Travis CI
PDF
Cocoapods and Most common used library in Swift
PDF
Openwhisk - Colorado Meetups
DOCX
.Net framework 4.5 on raspberry pi
DOCX
.Net framework 4.5 on raspberry pi
PPT
Introduction to Java Programming, Basic Structure, variables Data type, input...
PDF
PHP on Google App Engine
PDF
Installing spark scala console in windows 10
PDF
Docker module 1
PPTX
What is CocoaPods and how to setup?
PDF
IBM ConnectED 2015 - BP106 From XPages Hero To OSGi Guru: Taking The Scary Ou...
openCV and Java - Face Detection
OpenSCAP Overview(security scanning for docker image and container)
Introduction to java programming tutorial
Setting up and open fidy dev environment
B wapp – bee bug – installation
Java Device I/O at Raspberry PI to Build a Candy Vending Machine
AWS EC2 Ubuntu Instance - Step-by-Step Deployment Guide
Maven Introduction
Raspberry pi performace and program by open cv
PVS-Studio in the Clouds: Travis CI
Cocoapods and Most common used library in Swift
Openwhisk - Colorado Meetups
.Net framework 4.5 on raspberry pi
.Net framework 4.5 on raspberry pi
Introduction to Java Programming, Basic Structure, variables Data type, input...
PHP on Google App Engine
Installing spark scala console in windows 10
Docker module 1
What is CocoaPods and how to setup?
IBM ConnectED 2015 - BP106 From XPages Hero To OSGi Guru: Taking The Scary Ou...
Ad

More from Azilen Technologies Pvt. Ltd. (20)

PDF
Software Product Development for Startups.pdf
PPTX
How Chatbots Empower Healthcare Ecosystem?
PPTX
[Step by-step guide] configure document generation functionality in ms dynami...
PPTX
How to overcome operational challenges in getting consistent beacon behavior
PPTX
Liferay dxp – the good, the bad and the ugly
PPTX
Realm mobile platform – explore real time data synchronization capabilities
PPTX
A step by step guide to develop temperature sensor io t application using ibm...
PPTX
How to create an angular 2.0 application in liferay dxp to fetch the ootb adv...
PPTX
Register Virtual Device and analyze the device data
PPTX
Analytics and etl based bi solutions
PPTX
Advanced risk management & mitigation system
PPTX
Server driven user interface (sdui) – framework for i os applications!
PPTX
How to integrate portlet as widget in liferay to any website application
PPTX
A walkthrough of recently held wwdc17
PPTX
How wearable devices are changing our lives
PPTX
iPad Application as Return Process Automation Solution for eCommerce Store
PPTX
[Part 3] automation of home appliances using raspberry pi – all set to automa...
PPTX
Rfid systems for asset management — the young technology on its winning path
PPTX
[Part 2] automation of home appliances using raspberry pi – implementation of...
PPTX
Google cardboard the most cost effective virtual reality technology by google
Software Product Development for Startups.pdf
How Chatbots Empower Healthcare Ecosystem?
[Step by-step guide] configure document generation functionality in ms dynami...
How to overcome operational challenges in getting consistent beacon behavior
Liferay dxp – the good, the bad and the ugly
Realm mobile platform – explore real time data synchronization capabilities
A step by step guide to develop temperature sensor io t application using ibm...
How to create an angular 2.0 application in liferay dxp to fetch the ootb adv...
Register Virtual Device and analyze the device data
Analytics and etl based bi solutions
Advanced risk management & mitigation system
Server driven user interface (sdui) – framework for i os applications!
How to integrate portlet as widget in liferay to any website application
A walkthrough of recently held wwdc17
How wearable devices are changing our lives
iPad Application as Return Process Automation Solution for eCommerce Store
[Part 3] automation of home appliances using raspberry pi – all set to automa...
Rfid systems for asset management — the young technology on its winning path
[Part 2] automation of home appliances using raspberry pi – implementation of...
Google cardboard the most cost effective virtual reality technology by google

Recently uploaded (20)

PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Approach and Philosophy of On baking technology
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
KodekX | Application Modernization Development
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
A Presentation on Artificial Intelligence
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Network Security Unit 5.pdf for BCA BBA.
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Approach and Philosophy of On baking technology
“AI and Expert System Decision Support & Business Intelligence Systems”
KodekX | Application Modernization Development
Building Integrated photovoltaic BIPV_UPV.pdf
Empathic Computing: Creating Shared Understanding
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
The Rise and Fall of 3GPP – Time for a Sabbatical?
Mobile App Security Testing_ A Comprehensive Guide.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
A Presentation on Artificial Intelligence
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Chapter 3 Spatial Domain Image Processing.pdf
Bridging biosciences and deep learning for revolutionary discoveries: a compr...

[Part 1] automation of home appliances using raspberry pi – software installation guide

  • 2. Intro At Azilen, we believe in creating smart solutions for an interconnected and intelligent world. With emergence of IoT we try to achieve advanced connectivity and ensure efficiency through connected devices and network sensors. Our recent work on the automation of home appliances through gesture recognition is one such example where we aim to control and automate home appliances such as air conditioners and televisions. We have achieved gesture recognition for implementing functionality like Turning On-Off, Increasing and decreasing the temperature for Air-conditioner and Turning On-Off for Television.
  • 3. Through an extensive research, our team explored various feasible options for selecting the right platform and suitable libraries to make real time computer vision possible for gesture recognition. From Omega ,Chip, Aurduino ,Raspberry Pi amongst the platform and from BoofCV, OpenIMAJ, MATLAB, OpenCV and JavaCV among the libraries, the team selected Raspberry Pi and leading open source library ”Open CV” and its java port “JavaCV” as the right platform to make computer vision and image processing possible. The library has more than 2500 optimized algorithms, which includes a comprehensive set of both classic and state-of-the-art computer vision and machine learning algorithms. These algorithms can be used to detect and recognize faces, identify objects, classify human actions in videos, track camera movements, track moving objects, etc. This blog talks about the complete step by step guide to setup OpenCV and JavaCV on Raspberry Pi.
  • 4. Step by Step Guide to Setup OpenCV and JavaCV on Raspberry Pi
  • 5. Note: We assume that you have pre-installed latest Raspbian operating system on your Raspberry-Pi. If not please follow this link to install latest Raspbian on your Raspberry-Pi. https://www.raspberrypi.org/downloads/noobs/
  • 6. Installation Guide: Step-1: Update Raspbian Please follow below steps to setup OpenCV and JavaCV on Raspberry Pi Step-1: Update Raspbian At the start you need compiler tools so update and upgrade the Raspberry Pi (Raspbian Linux) with latest available packages Get all the compiler tools and video libraries using the below commands: Open the terminal window and fire following commands one by one 1 sudo apt-get update 2 sudo apt-get upgrade
  • 7. Step-2: Install Dependencies – Open CV requires few external dependencies for it to be able to run, therefore you need to install all the required dependencies in the following order: Open the terminal window and fire following commands one by one
  • 9. Note: If some of the libraries fail to download, then try to look for a different version of the library using apt-cache search as some of these libraries are not in Raspbian repository anymore or are available with newer versions For e.g. : 1 sudo apt-cache search ffmpeg
  • 10. Step 3: Download OpenCV Source Code and Install Now we have our dependencies installed, let’s grab the OpenCV archive version 2.4.13 from the official OpenCV repository. (Note: As future versions of OpenCV are released, you can replace 3.1.0, 3.2.0 with the latest version number, but this guide is focused around version 2.4.13). wget https://sourceforge.net/projects/OpenCVlibrary/files/OpenCV- unix/2.4.13/OpenCV-2.4.13.zip/download Uncompress the downloaded source file Move into uncompressed directore and create a new directory named “release” inside it Run below commands to configure, compile and install OpenCV.Please note that compilation will take approximately 4-5 hours, so grab yourself a nice pizza and relax !
  • 11. 1 cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local .. 2 make 3 sudo make install 4 sudo idconfig
  • 12. After cmake is done successfully, the jar file will be under release/bin/ and release/lib/ folder. Since we build version 2.4.13, the generated file will be named OpenCV-2413.jar and libOpenCV_java.so. Both generated files will required in build path for any java based project with OpenCV. While libOpenCV_java.so is required for any C/C++ based project with OpenCV.
  • 13. Note: If you get any Linker error or java.library.path issue ,you need to provide path for generated OpenCV jar file with java -jar cmd. using – Djava.library.path= ‘path to OpenCV libs’ or you can export LD_LIBRARY_PATH system variable with lib path. you can also add export command to .bashcr file as well
  • 14. Step 4 : Compile JavaCV / javaCPP Now that we have compiled and installed OpenCV 2.4.13 on our Raspberry Pi, we can compile and install JavaCV and JavaCPP on Raspberry Pi. In order to do that, you need to have Java, Maven and Git installed on the Raspberry Pi. The compilation of JavaCV and javaCPP does not run with all versions of Java (such as Oracle JDK 8). It runs correctly with OpenJDK 7 which needs to be installed temporarily for this purpose if it’s not already installed. There might be multiple versions of Java installed. It needs to be ensured that OpenJDK 7 is the default selected Java version. Please run following commands on your terminal window to install OpenJDK.
  • 15. Install OpenJDK 7 and select OpenJDK 7 as default Java version: 1 sudo apt-get install openjdk-7-jdk 2 sudo update-alternatives --config java 3 sudo update-alternatives --config javac
  • 16. For JavaCV / javaCPP Maven is needed. The source will be downloaded using Git. Once the source is downloded reset the sources to the old version 0.7 of JavaCV and javaCPP as they are the recent working ones for our purpose. Two modifications to the source files need to be performed to run on the Raspberry Pi and these will be done with a sed command. Afterwards the compilation can be started. Run the following commands in terminal window: (Follow steps in order)
  • 18. And that’s it. You have successfully installed JavaCV/JavaCPP on Raspberry Pi. Next step is to verify your installation.
  • 19. Step 5: Testing your OpenCV / JavaCV Installation Open your favorite editor on Raspberry Pi (VI/NANO/PageLeaf). Create a new java file as shown below and save the file.
  • 20. • Note: Raspbian ships latest Oracle JDK version with it. Please use command ‘whereis java’ to find out the location of the Oracle JDK and make it default java version now onwards. Now compile this file using Oracle JDK version >= 7. Type following commands into your terminal to compile and run this java code. 1 javac –cp ‘path to generated JavaCV-2.4.13.jar’ JavaCVTest.java 2 java –cp ‘path to generated JavaCV-2.4.13.jar’ – Djava.library.path=’path to generated OpenCV-2.4.13.so’ JavaCVTest
  • 21. The java code output must be as below: Congrats! You have a brand new, fresh install of OpenCV / JavaCV on your Raspberry Pi. And I’m sure you’re just itching to leverage your Raspberry Pi to build some awesome computer vision apps.
  • 22. Conclusion Our comprehensive approach can help implement various IoT solutions such as color detection, face recognition system, motion tracking, Object identification and Mobile robotics. So, what’s next? In our upcoming blog we aim to write about complete guide for automating air conditioner and television appliances for implementing features through gesture recognition.
  • 24. Thanks You www.azilen.com Let us know if you have any Question! info@azilen.com | +1-972-325-2243