SlideShare a Scribd company logo
1 of 32
Meghadoot Gardi Rohith Raju
09.02.2017 ESM DPS WS 2016/2017 1
Implementing a parallel OpenCV
application on Raspberry Pi 3
Agenda
• Project Statement​
• Platforms used for implementation​
• Raspberry Pi 3​
• OPENCV(3.1.0)with JAVA​
• What is parallelism and What were parallel image processing approaches for the
problem statement​
• Which were software platforms for coding, which we have chosen and why​
• Approaches for parallelization in JAVA Eg. Fork join , stream etc. (why ForkJoinPool)​
• Live demo: Blue scaler and Intensity Detection (Filter Operation)
• Lessons learnt: (Including Problems which we have faced)​
• References
09.02.2017 ESM DPS WS 2016/2017 2Meghadoot Gardi
What?
09.02.2017 ESM DPS WS 2016/2017 3
Hardware Parallelism Real Time Computer Vision
Rohith Raju
Why?
09.02.2017 ESM DPS WS 2016/2017 4
Improved System Performance
Increased Portability
Low Costs Involved
Rohith Raju
Hardware Platform
Raspberry Pi-3 B
• It Is a single board and credit card
size personal computer.
• Build by Raspberry Pi Foundation in
the United Kingdom
• Intention to promote computer
science teaching
• Application :Home automation,
Embedded Prototyping
09.02.2017 ESM DPS WS 2016/2017 5
Meghadoot Gardi
Hardware Platform
Raspberry Pi-3 B
• RPI 3: 1.2GHz
• 64-bit quad-core
ARMv8 CPU
• 1GB RAM
• 802.11n Wireless LAN
• Camera interface
(CSI)
• Micro SD card slot
09.02.2017 ESM DPS WS 2016/2017 6Meghadoot Gardi
Models and Features
Type Model A Model B Zero
genera
tion
1 1+ 1 1+ 2 2 ver
1.2
3 Ver 1.2 Ver 1.3
Releas
e
02/12 11/14 05/12 07/14 02/15 10/16 02/16 10/15 05/16
Price
(US$)
25 20 35 25 35 5 US$
CPU 700 MHz, single 900 MHz, quad 1.2
GHz,
quad
1 GHz, single
32 bits 64 bits 32 bits
RAM 256MB 512 MB 1 GB 512 MB
USB 1 2 4 1 micro
mA 300 200 700 600 800 ~160 Meghadoot Gardi
• Most used:
• Raspbian, Raspbian Lite
• Ubuntu MATE
• Snappy Ubuntu Core(Third party)
• Windows 10 loT core(Third party)
• RISC OS
• Why Raspbian:
• Widely Used
• User Friendly(programming friendly)
os
Meghadoot Gardi
Raspberry Pi basic configuration
• Download OS on
Desktop or system.
• Format memory card
• Load OS image in the
memory card
• Create an empty SSH
folder in BOOT partition
• Insert memory card into
RPI and connect the
module to Wi-Fi router
via LAN cable (the DHCP
allows assigning dynamic
IP to RPI)
• Access the raspberry pi
via putty or MSYS2
Meghadoot Gardi
Raspberry Pi basic configuration
• Expand file system:
• sudo raspi-config  Expand Filesystem
• sudo reboot
• Update OS to the latest version
• sudo apt-get update (updates the list of available packages and
their versions, but doesn’t install them)
• sudo apt-get upgrade (installs newer versions of the packages)
• sudo reboot
Meghadoot Gardi
Enabling Desktop Environment
Meghadoot Gardi
Enable
remote
desktop
services
Install login
manager
Install PIXEL
environment
Install Xorg
Display
Server
sudo apt-get install --
no-install-
recommends xserver-
xorg
sudo apt-get
install raspberrypi-ui-
mods
sudo apt-get
install lightdm
sudo apt-get install xrdp
Enabling Desktop Environment
• VNC Server will then start automatically whenever your Raspberry Pi is
powered on.
• To enable, VNC Server at the command line:
• Pass command : sudo raspi-config
• Navigate to Interfacing Options
• Scroll down and select VNC > Yes.
• Sudo reboot
Meghadoot Gardi
Enabling Camera Interface
• sudo modprobe bcm2825-v412
To automatically detect camera hardware.
• sudo raspistill -o xyz.jpg
Command to capture image
Meghadoot Gardi
OpenCV
09.02.2017 ESM DPS WS 2016/2017 14Rohith Raju
• OpenCV (Open Source ComputerVision Library)
• Developed by Intel, and now supported by Willow Garage and Itseez.
• It is free for use under the open source BSD license.
• The library is cross-platform.
• It focuses mainly on real-time image processing.
• Performance
• around 30 frames processed per seconds in real time image
processing (OpenCV)
• Implementations
Facial recognition system, Gesture recognition,
Human–computer interaction , Mobile robotics,
Motion tracking, Augmented reality
OpenCV
09.02.2017 ESM DPS WS 2016/2017 15Rohith Raju
OpenCV 3.1 Java Libraries features
Image Container
Blue
-Green-
Red
General Image
Processing Functions
Segmentation Camera Caliberation,
Stereo, 3D
Machine Learning
Detection
Recognition
Tracking Fitting
Java and OpenCV Installation
09.02.2017 ESM DPS WS 2016/2017 16Rohith Raju
Installing
OpenCV 3.1.0
• Compile & Build using
cmake
• Install libraries
Setting
Environment
Variables
Installing
dependent
Libraries
• Jpeg,tiff-Image libraries
• Image Compression
libraries
• Video Compression libraries
• Interface Compiler
Installing Ant
1.9.8
Installing Java
Development
Kit 8
Parallelization Approaches
• Java Stream
• Java Fork and Join Pool
• CUDA API
• OpenCV pool parallelization(parallel_for).
09.02.2017 ESM DPS WS 2016/2017 17Rohith Raju
Concept Join Fork
09.02.2017 ESM DPS WS 2016/2017 18Rohith Raju
Concept Join Fork
09.02.2017 ESM DPS WS 2016/2017 19Rohith Raju
Main Class Fork and Join Class
Object ->
java.util.concurrent.ForkJoinPool
with number of processors used as
arguments.
Object of Fork and Join Class ->
java.util.concurrent.RecursiveAction
Begin Parallel processing ->
extends -> RecursiveAction
Default Method -> Compute
if-> Recursive Calls
else-> Intended Algorithm
Algorithm Implementation
09.02.2017 ESM DPS WS 2016/2017 20
Capture Image
• Load to Pi
• Stream From
Camera
Processing
• Load to Java
• Real Time
Processing
Serial
Processing
• OpenCV Libraries
Hardware
Parallelism
• Java Parallelism
• Task Division
Algorithm
Implementation
• OpenCV Libraries
Output
Comparison
• Parallel processing
• Serial processing
Rohith Raju
Algorithm Implementation
09.02.2017 ESM DPS WS 2016/2017 21Rohith Raju
B G R
B=B+G+R
BLUESCALER
B 0 0
Implementation Of Blue Scaler
(Using Join Fork)
09.02.2017 ESM DPS WS 2016/2017 22Rohith Raju
BLUESCALER
Identification of Light Intensity
(Using Sobel Operator)
• Concept
• Application
• How Parallelization is achieved?
• Step By Step Overview
• Live Demo
09.02.2017 ESM DPS WS 2016/2017 23Meghadoot Gardi
Concept
• Sobel to calculate the derivatives from an image.
• This Derivative mask is also used as an Gradient. Sobel operator is used to
detect two kinds of edges in an image: Vertical direction edges and
Horizontal direction edges.
• This principle can be deployed in Identification of the “Intensity distribution
of Light Source”.
09.02.2017 ESM DPS WS 2016/2017 24Meghadoot Gardi
Concept
• A good way to express Pixel
intensity changes is by using derivatives
• A high change in gradient indicates a major
change in the image
• The intensity change in the vicinity of source
is shown by the “jump” in intensity in the
plot
• The edge “jump” can be seen more easily if
we take the first derivative
09.02.2017 ESM DPS WS 2016/2017 25Meghadoot Gardi
Insights of Output
(with only sunlight and with Lamp )
09.02.2017 ESM DPS WS 2016/2017 26Meghadoot Gardi
Algorithm Implementation
09.02.2017 ESM DPS WS 2016/2017 27
IDENTIFICATION OF INTENSIY OF SOURCE
B G R
Gray=B+G+R
Gray
Vertical
derivative
Horizontal
derivative
Gradient
Approximation
(RMS)
Steps to be followed:
Gray Scale Conversion
Gaussian Blur Implementation (In case of HD Images)
Sobel Filtering of Image
Meghadoot Gardi
Parallelization of algorithm
• Join-Fork Pool Implementation in
JAVA
• Fork for Gray Scale Implementation
• Join to get Gray Scale image
• Fork for Sobel implementation
• Join to get Intensity detailed Image
Demo
09.02.2017 ESM DPS WS 2016/2017 29
Conclusion
• What we have learnt:
• Image Processing using OpenCV Libraries
• Various Image Processing Algorithms and Filters
• Parallelization of Image Processing Algorithms (Some Exceptions Eg. Face Detection, Canny Edge
Detection)
• Problems Faced during Implementation:
• Interfacing issues with the Raspberry-Pi and Camera
• Installation and Compilation of OpenCV on Pi
• Installing JDK
• Version Change in OpenCV
09.02.2017 ESM DPS WS 2016/2017 30
References
• http://docs.opencv.org/2.4/doc/tutorials/imgproc/imgtrans/sobel_derivativ
es/sobel_derivatives.html#sobel-derivatives
• Learning OpenCV by Bradski and Kaehler
• https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ForkJoinPo
ol.html
• http://robinhenniges.com/en/install-opencv-for-java-raspberry-pi-debian-
jessy
• http://www.samontab.com/web/2014/06/installing-opencv-2-4-9-in-
ubuntu-14-04-lts/
09.02.2017 ESM DPS WS 2016/2017 31
09.02.2017 ESM DPS WS 2016/2017 32

More Related Content

What's hot

What's hot (13)

Hadoop analytics provisioning based on a virtual infrastructure
Hadoop analytics provisioning based on a virtual infrastructureHadoop analytics provisioning based on a virtual infrastructure
Hadoop analytics provisioning based on a virtual infrastructure
 
NVIDIA深度學習教育機構 (DLI): Object detection with jetson
NVIDIA深度學習教育機構 (DLI): Object detection with jetsonNVIDIA深度學習教育機構 (DLI): Object detection with jetson
NVIDIA深度學習教育機構 (DLI): Object detection with jetson
 
Federated HPC Clouds applied to Radiation Therapy
Federated HPC Clouds applied to Radiation TherapyFederated HPC Clouds applied to Radiation Therapy
Federated HPC Clouds applied to Radiation Therapy
 
Siggraph 2016 - Vulkan and nvidia : the essentials
Siggraph 2016 - Vulkan and nvidia : the essentialsSiggraph 2016 - Vulkan and nvidia : the essentials
Siggraph 2016 - Vulkan and nvidia : the essentials
 
Escape the Walls of PaaS: Unlock the Power & Flexibility of DigitalOcean App ...
Escape the Walls of PaaS: Unlock the Power & Flexibility of DigitalOcean App ...Escape the Walls of PaaS: Unlock the Power & Flexibility of DigitalOcean App ...
Escape the Walls of PaaS: Unlock the Power & Flexibility of DigitalOcean App ...
 
Horovod - Distributed TensorFlow Made Easy
Horovod - Distributed TensorFlow Made EasyHorovod - Distributed TensorFlow Made Easy
Horovod - Distributed TensorFlow Made Easy
 
MEW22 22nd Machine Evaluation Workshop Microsoft
MEW22 22nd Machine Evaluation Workshop MicrosoftMEW22 22nd Machine Evaluation Workshop Microsoft
MEW22 22nd Machine Evaluation Workshop Microsoft
 
産総研におけるプライベートクラウドへの取り組み
産総研におけるプライベートクラウドへの取り組み産総研におけるプライベートクラウドへの取り組み
産総研におけるプライベートクラウドへの取り組み
 
20180926 kubeflow-meetup-1-kubeflow-operators-Preferred Networks-Shingo Omura
20180926 kubeflow-meetup-1-kubeflow-operators-Preferred Networks-Shingo Omura20180926 kubeflow-meetup-1-kubeflow-operators-Preferred Networks-Shingo Omura
20180926 kubeflow-meetup-1-kubeflow-operators-Preferred Networks-Shingo Omura
 
GPU-Accelerating A Deep Learning Anomaly Detection Platform
GPU-Accelerating A Deep Learning Anomaly Detection PlatformGPU-Accelerating A Deep Learning Anomaly Detection Platform
GPU-Accelerating A Deep Learning Anomaly Detection Platform
 
Microsoft Azure in HPC scenarios
Microsoft Azure in HPC scenariosMicrosoft Azure in HPC scenarios
Microsoft Azure in HPC scenarios
 
Hadoop mapreduce performance study on arm cluster
Hadoop mapreduce performance study on arm clusterHadoop mapreduce performance study on arm cluster
Hadoop mapreduce performance study on arm cluster
 
Clustering tensor flow con kubernetes y raspberry pi
Clustering tensor flow con kubernetes y raspberry piClustering tensor flow con kubernetes y raspberry pi
Clustering tensor flow con kubernetes y raspberry pi
 

Similar to Implementing a parallel_open_cv_application_on_raspberry_pi3(1)

Ijsrdv1 i4049
Ijsrdv1 i4049Ijsrdv1 i4049
Ijsrdv1 i4049
ijsrd.com
 
"Combining Flexibility and Low-Power in Embedded Vision Subsystems: An Applic...
"Combining Flexibility and Low-Power in Embedded Vision Subsystems: An Applic..."Combining Flexibility and Low-Power in Embedded Vision Subsystems: An Applic...
"Combining Flexibility and Low-Power in Embedded Vision Subsystems: An Applic...
Edge AI and Vision Alliance
 
Law cost portable machine vision system
Law cost portable machine vision systemLaw cost portable machine vision system
Law cost portable machine vision system
Sagarika Muthukumarana
 

Similar to Implementing a parallel_open_cv_application_on_raspberry_pi3(1) (20)

Ijsrdv1 i4049
Ijsrdv1 i4049Ijsrdv1 i4049
Ijsrdv1 i4049
 
OSGeo Live Lightening Overview
OSGeo Live Lightening OverviewOSGeo Live Lightening Overview
OSGeo Live Lightening Overview
 
Computer preemption and TotalView have made debugging Pascal much more seamless
Computer preemption and TotalView have made debugging Pascal much more seamlessComputer preemption and TotalView have made debugging Pascal much more seamless
Computer preemption and TotalView have made debugging Pascal much more seamless
 
Installing Rational Rhapsody Designer 8.2 or 8.2.1 for Executable MBSE
Installing Rational Rhapsody Designer 8.2 or 8.2.1 for Executable MBSEInstalling Rational Rhapsody Designer 8.2 or 8.2.1 for Executable MBSE
Installing Rational Rhapsody Designer 8.2 or 8.2.1 for Executable MBSE
 
IBM Rational Rhapsody 8.3.1 install guide with Cygwin for Executable MBSE
IBM Rational Rhapsody 8.3.1 install guide with Cygwin for Executable MBSEIBM Rational Rhapsody 8.3.1 install guide with Cygwin for Executable MBSE
IBM Rational Rhapsody 8.3.1 install guide with Cygwin for Executable MBSE
 
Labview1_ Computer Applications in Control_ACRRL
Labview1_ Computer Applications in Control_ACRRLLabview1_ Computer Applications in Control_ACRRL
Labview1_ Computer Applications in Control_ACRRL
 
Rational Rhapsody 8.3 with Cygwin and iFixes (www.executablembse.com)
Rational Rhapsody 8.3 with Cygwin and iFixes (www.executablembse.com)Rational Rhapsody 8.3 with Cygwin and iFixes (www.executablembse.com)
Rational Rhapsody 8.3 with Cygwin and iFixes (www.executablembse.com)
 
Cloud Foundry Summit 2017
Cloud Foundry Summit 2017Cloud Foundry Summit 2017
Cloud Foundry Summit 2017
 
State of GeoServer
State of GeoServerState of GeoServer
State of GeoServer
 
OpenCV @ Droidcon 2012
OpenCV @ Droidcon 2012OpenCV @ Droidcon 2012
OpenCV @ Droidcon 2012
 
"Combining Flexibility and Low-Power in Embedded Vision Subsystems: An Applic...
"Combining Flexibility and Low-Power in Embedded Vision Subsystems: An Applic..."Combining Flexibility and Low-Power in Embedded Vision Subsystems: An Applic...
"Combining Flexibility and Low-Power in Embedded Vision Subsystems: An Applic...
 
CMP213_GPU(G3) Applications in Media and Entertainment Workloads
CMP213_GPU(G3) Applications in Media and Entertainment WorkloadsCMP213_GPU(G3) Applications in Media and Entertainment Workloads
CMP213_GPU(G3) Applications in Media and Entertainment Workloads
 
AWS CZSK Webinar - Migrácia desktopov a aplikácií do AWS cloudu s Amazon Work...
AWS CZSK Webinar - Migrácia desktopov a aplikácií do AWS cloudu s Amazon Work...AWS CZSK Webinar - Migrácia desktopov a aplikácií do AWS cloudu s Amazon Work...
AWS CZSK Webinar - Migrácia desktopov a aplikácií do AWS cloudu s Amazon Work...
 
Law cost portable machine vision system
Law cost portable machine vision systemLaw cost portable machine vision system
Law cost portable machine vision system
 
Quick-and-Easy Deployment of a Ceph Storage Cluster
Quick-and-Easy Deployment of a Ceph Storage ClusterQuick-and-Easy Deployment of a Ceph Storage Cluster
Quick-and-Easy Deployment of a Ceph Storage Cluster
 
Raising ux bar with offline first design
Raising ux bar with offline first designRaising ux bar with offline first design
Raising ux bar with offline first design
 
Best Practices - By Lofi Dewanto
Best Practices - By Lofi DewantoBest Practices - By Lofi Dewanto
Best Practices - By Lofi Dewanto
 
Automatic License Plate Recognition using OpenCV
Automatic License Plate Recognition using OpenCVAutomatic License Plate Recognition using OpenCV
Automatic License Plate Recognition using OpenCV
 
Automatic License Plate Recognition using OpenCV
Automatic License Plate Recognition using OpenCV Automatic License Plate Recognition using OpenCV
Automatic License Plate Recognition using OpenCV
 
Introduction to Software Defined Visualization (SDVis)
Introduction to Software Defined Visualization (SDVis)Introduction to Software Defined Visualization (SDVis)
Introduction to Software Defined Visualization (SDVis)
 

Recently uploaded

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Recently uploaded (20)

Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactistics
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 

Implementing a parallel_open_cv_application_on_raspberry_pi3(1)

  • 1. Meghadoot Gardi Rohith Raju 09.02.2017 ESM DPS WS 2016/2017 1 Implementing a parallel OpenCV application on Raspberry Pi 3
  • 2. Agenda • Project Statement​ • Platforms used for implementation​ • Raspberry Pi 3​ • OPENCV(3.1.0)with JAVA​ • What is parallelism and What were parallel image processing approaches for the problem statement​ • Which were software platforms for coding, which we have chosen and why​ • Approaches for parallelization in JAVA Eg. Fork join , stream etc. (why ForkJoinPool)​ • Live demo: Blue scaler and Intensity Detection (Filter Operation) • Lessons learnt: (Including Problems which we have faced)​ • References 09.02.2017 ESM DPS WS 2016/2017 2Meghadoot Gardi
  • 3. What? 09.02.2017 ESM DPS WS 2016/2017 3 Hardware Parallelism Real Time Computer Vision Rohith Raju
  • 4. Why? 09.02.2017 ESM DPS WS 2016/2017 4 Improved System Performance Increased Portability Low Costs Involved Rohith Raju
  • 5. Hardware Platform Raspberry Pi-3 B • It Is a single board and credit card size personal computer. • Build by Raspberry Pi Foundation in the United Kingdom • Intention to promote computer science teaching • Application :Home automation, Embedded Prototyping 09.02.2017 ESM DPS WS 2016/2017 5 Meghadoot Gardi
  • 6. Hardware Platform Raspberry Pi-3 B • RPI 3: 1.2GHz • 64-bit quad-core ARMv8 CPU • 1GB RAM • 802.11n Wireless LAN • Camera interface (CSI) • Micro SD card slot 09.02.2017 ESM DPS WS 2016/2017 6Meghadoot Gardi
  • 7. Models and Features Type Model A Model B Zero genera tion 1 1+ 1 1+ 2 2 ver 1.2 3 Ver 1.2 Ver 1.3 Releas e 02/12 11/14 05/12 07/14 02/15 10/16 02/16 10/15 05/16 Price (US$) 25 20 35 25 35 5 US$ CPU 700 MHz, single 900 MHz, quad 1.2 GHz, quad 1 GHz, single 32 bits 64 bits 32 bits RAM 256MB 512 MB 1 GB 512 MB USB 1 2 4 1 micro mA 300 200 700 600 800 ~160 Meghadoot Gardi
  • 8. • Most used: • Raspbian, Raspbian Lite • Ubuntu MATE • Snappy Ubuntu Core(Third party) • Windows 10 loT core(Third party) • RISC OS • Why Raspbian: • Widely Used • User Friendly(programming friendly) os Meghadoot Gardi
  • 9. Raspberry Pi basic configuration • Download OS on Desktop or system. • Format memory card • Load OS image in the memory card • Create an empty SSH folder in BOOT partition • Insert memory card into RPI and connect the module to Wi-Fi router via LAN cable (the DHCP allows assigning dynamic IP to RPI) • Access the raspberry pi via putty or MSYS2 Meghadoot Gardi
  • 10. Raspberry Pi basic configuration • Expand file system: • sudo raspi-config  Expand Filesystem • sudo reboot • Update OS to the latest version • sudo apt-get update (updates the list of available packages and their versions, but doesn’t install them) • sudo apt-get upgrade (installs newer versions of the packages) • sudo reboot Meghadoot Gardi
  • 11. Enabling Desktop Environment Meghadoot Gardi Enable remote desktop services Install login manager Install PIXEL environment Install Xorg Display Server sudo apt-get install -- no-install- recommends xserver- xorg sudo apt-get install raspberrypi-ui- mods sudo apt-get install lightdm sudo apt-get install xrdp
  • 12. Enabling Desktop Environment • VNC Server will then start automatically whenever your Raspberry Pi is powered on. • To enable, VNC Server at the command line: • Pass command : sudo raspi-config • Navigate to Interfacing Options • Scroll down and select VNC > Yes. • Sudo reboot Meghadoot Gardi
  • 13. Enabling Camera Interface • sudo modprobe bcm2825-v412 To automatically detect camera hardware. • sudo raspistill -o xyz.jpg Command to capture image Meghadoot Gardi
  • 14. OpenCV 09.02.2017 ESM DPS WS 2016/2017 14Rohith Raju • OpenCV (Open Source ComputerVision Library) • Developed by Intel, and now supported by Willow Garage and Itseez. • It is free for use under the open source BSD license. • The library is cross-platform. • It focuses mainly on real-time image processing. • Performance • around 30 frames processed per seconds in real time image processing (OpenCV) • Implementations Facial recognition system, Gesture recognition, Human–computer interaction , Mobile robotics, Motion tracking, Augmented reality
  • 15. OpenCV 09.02.2017 ESM DPS WS 2016/2017 15Rohith Raju OpenCV 3.1 Java Libraries features Image Container Blue -Green- Red General Image Processing Functions Segmentation Camera Caliberation, Stereo, 3D Machine Learning Detection Recognition Tracking Fitting
  • 16. Java and OpenCV Installation 09.02.2017 ESM DPS WS 2016/2017 16Rohith Raju Installing OpenCV 3.1.0 • Compile & Build using cmake • Install libraries Setting Environment Variables Installing dependent Libraries • Jpeg,tiff-Image libraries • Image Compression libraries • Video Compression libraries • Interface Compiler Installing Ant 1.9.8 Installing Java Development Kit 8
  • 17. Parallelization Approaches • Java Stream • Java Fork and Join Pool • CUDA API • OpenCV pool parallelization(parallel_for). 09.02.2017 ESM DPS WS 2016/2017 17Rohith Raju
  • 18. Concept Join Fork 09.02.2017 ESM DPS WS 2016/2017 18Rohith Raju
  • 19. Concept Join Fork 09.02.2017 ESM DPS WS 2016/2017 19Rohith Raju Main Class Fork and Join Class Object -> java.util.concurrent.ForkJoinPool with number of processors used as arguments. Object of Fork and Join Class -> java.util.concurrent.RecursiveAction Begin Parallel processing -> extends -> RecursiveAction Default Method -> Compute if-> Recursive Calls else-> Intended Algorithm
  • 20. Algorithm Implementation 09.02.2017 ESM DPS WS 2016/2017 20 Capture Image • Load to Pi • Stream From Camera Processing • Load to Java • Real Time Processing Serial Processing • OpenCV Libraries Hardware Parallelism • Java Parallelism • Task Division Algorithm Implementation • OpenCV Libraries Output Comparison • Parallel processing • Serial processing Rohith Raju
  • 21. Algorithm Implementation 09.02.2017 ESM DPS WS 2016/2017 21Rohith Raju B G R B=B+G+R BLUESCALER B 0 0
  • 22. Implementation Of Blue Scaler (Using Join Fork) 09.02.2017 ESM DPS WS 2016/2017 22Rohith Raju BLUESCALER
  • 23. Identification of Light Intensity (Using Sobel Operator) • Concept • Application • How Parallelization is achieved? • Step By Step Overview • Live Demo 09.02.2017 ESM DPS WS 2016/2017 23Meghadoot Gardi
  • 24. Concept • Sobel to calculate the derivatives from an image. • This Derivative mask is also used as an Gradient. Sobel operator is used to detect two kinds of edges in an image: Vertical direction edges and Horizontal direction edges. • This principle can be deployed in Identification of the “Intensity distribution of Light Source”. 09.02.2017 ESM DPS WS 2016/2017 24Meghadoot Gardi
  • 25. Concept • A good way to express Pixel intensity changes is by using derivatives • A high change in gradient indicates a major change in the image • The intensity change in the vicinity of source is shown by the “jump” in intensity in the plot • The edge “jump” can be seen more easily if we take the first derivative 09.02.2017 ESM DPS WS 2016/2017 25Meghadoot Gardi
  • 26. Insights of Output (with only sunlight and with Lamp ) 09.02.2017 ESM DPS WS 2016/2017 26Meghadoot Gardi
  • 27. Algorithm Implementation 09.02.2017 ESM DPS WS 2016/2017 27 IDENTIFICATION OF INTENSIY OF SOURCE B G R Gray=B+G+R Gray Vertical derivative Horizontal derivative Gradient Approximation (RMS) Steps to be followed: Gray Scale Conversion Gaussian Blur Implementation (In case of HD Images) Sobel Filtering of Image Meghadoot Gardi
  • 28. Parallelization of algorithm • Join-Fork Pool Implementation in JAVA • Fork for Gray Scale Implementation • Join to get Gray Scale image • Fork for Sobel implementation • Join to get Intensity detailed Image
  • 29. Demo 09.02.2017 ESM DPS WS 2016/2017 29
  • 30. Conclusion • What we have learnt: • Image Processing using OpenCV Libraries • Various Image Processing Algorithms and Filters • Parallelization of Image Processing Algorithms (Some Exceptions Eg. Face Detection, Canny Edge Detection) • Problems Faced during Implementation: • Interfacing issues with the Raspberry-Pi and Camera • Installation and Compilation of OpenCV on Pi • Installing JDK • Version Change in OpenCV 09.02.2017 ESM DPS WS 2016/2017 30
  • 31. References • http://docs.opencv.org/2.4/doc/tutorials/imgproc/imgtrans/sobel_derivativ es/sobel_derivatives.html#sobel-derivatives • Learning OpenCV by Bradski and Kaehler • https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ForkJoinPo ol.html • http://robinhenniges.com/en/install-opencv-for-java-raspberry-pi-debian- jessy • http://www.samontab.com/web/2014/06/installing-opencv-2-4-9-in- ubuntu-14-04-lts/ 09.02.2017 ESM DPS WS 2016/2017 31
  • 32. 09.02.2017 ESM DPS WS 2016/2017 32

Editor's Notes

  1. It’s a high computing device. Small sized,compact and portable personal computer. Designed and developed by RP foundation in UK. To encourage embedded prototyping.
  2. So this gave an idea of how we can access the RP but it is headless!! No screen and keyboard Hence, It is necessary to get access with remote login.
  3. modprobe is a Linux program originally written by Rusty Russell and used to add a loadable kernel module (LKM) to the Linux kernel or to remove a LKM from the kernel. It is commonly used indirectly: udev relies upon modprobe to load drivers for automatically detected hardware.
  4. OpenCV (Open Source Computer Vision) is a library of programming functions mainly aimed at real-time computer vision.[2]Originally developed by Intel's research center in Nizhny Novgorod (Russia), it was later supported by Willow Garage and is now maintained by Itseez.[1] The library is cross-platform and free for use under the open-source BSD license.
  5. OpenCV (Open Source Computer Vision) is a library of programming functions mainly aimed at real-time computer vision.[2]Originally developed by Intel's research center in Nizhny Novgorod (Russia), it was later supported by Willow Garage and is now maintained by Itseez.[1] The library is cross-platform and free for use under the open-source BSD license.
  6. CUDA is a parallel computing platform and application programming interface (API) model created by Nvidia.[1] It allows software developers and software engineers to use a CUDA-enabled graphics processing unit (GPU) for general purpose processing – an approach termed GPGPU (General-Purpose computing on Graphics Processing Units). The CUDA platform is a software layer that gives direct access to the GPU's virtual instruction set and parallel computational elements, for the execution of compute kernels.[2]
  7. Which will split the image until it matches the task size.