Raspberry Pi Using Open CV
which Has The Installing ,making
Programs And PerformancenabauaKazuhiko Inaba(inaba@Kazsansan)
I work as IT infrastructure
as usual in Japan
Others:Raspberry Pi, Zabbix, Linux, Drawing Picture
About the “Ahiruyaki” which means tweets returned
Messages on twitter, I’ve ever give a speech as
lightning talk in Riga Latvia.
Anyway,I want to live in Europe if I have a chance.
Such like a this guy I’m thinking about that .

Agenda1.What is Raspberry Pi ?
2.What does it mean by open CV ?
3.How to install ,compile open CV
for Raspberry Pi
4.How to make the program in open CV
for Raspberry Pi
5.How to use open CV for Raspberry Pi
6.Extras (What is this?)
7.Questions

1.What is Raspberry Pi?
The Raspberry Pi is a series of credit
card-sized single-board computersdeveloped in the United Kingdom by theRaspberry Pi Foundation to promote theteaching of basic computer science inschools and developing countries.
You can customize and optimize
whatever you want to do.

There are kinds of types
Model A/A+
Model B/B+
Model B++
Raspberry Pi 2
Raspberry Pi 3
Pi ZeroThis type is Raspberry Pi 3 which is new one.

Operating systems
The Raspberry Pi primarily uses
Raspbian, a Debian-based Linux operatingsystem.
Other third party operating systems available
via the official website include Ubuntu MATE,
Snappy Ubuntu Core, Windows 10 IoT Core,
RISC OS and specialised distributions for theKodi media center and classroom
management.
Many other operating systems can also run
on the Raspberry Pi.

Basically, Some of us use Raspbian, a Debianbased Linux operating system.
Of course, I’m using Raspbian, too.
So, I talk about Raspbian.
Ok Then.

2.What does it mean by open CV?
OpenCV is released under a BSD license andhence it’s free for both academic and commercial
use. It has C++, C, Python and Java interfaces andsupports Windows, Linux, Mac OS, iOS andAndroid. OpenCV was designed for computational
efficiency and with a strong focus on real-time
applications. Written in optimized C/C++, the library
can take advantage of multi-core processing.
Enabled with OpenCL, it can take advantage of thehardware acceleration of the underlying
heterogeneous compute platform.

Adopted all around the world, OpenCV has morethan 47 thousand people of user community andestimated number of downloads exceeding 9
million. Usage ranges from interactive art, tomines inspection, stitching maps on the web orthrough advanced robotics.

By using this, we are able to make a program
as follows.
・Customizing and optimizing picture file and motion
picture file・Showing and tracing a picture with the camera
・Detecting face and body・Extra
You can install open CV in Raspberry Pi or otheroperational system

Version
New version 3.1
For Raspberry Pi, it is better to use 2.4.13, because
It can’t be done for new version.
Download site
http://opencv.org/downloads.html
For Linux only if you use for Rasbian in Raspberry Pi
You can install open CV in Raspberry Pi or otheroperational system

3.How to install ,compile open CVfor Raspberry Pi
Beforehand:
Make sure Raspbian is up to date:#sudo apt-get update#sudo apt-get upgradeFirst do this:#sudo apt-get -y install build-essential cmake
cmake-curses-gui pkg-config libpng12-0 libpng12dev libpng++-dev libpng3 libpnglite-dev zlib1g-dbg
zlib1g zlib1g-dev pngtools libtiff4-dev libtiff4
libtiffxx0c2 libtiff-tools libeigen3-dev

You can add in cmake-qt-gui if you want a GUI for
cmake, and don’t like ccmake.
#sudo apt-get -y install libjpeg8 libjpeg8-dev
libjpeg8-dbg libjpeg-progs ffmpeg libavcodec-dev
libavcodec53 libavformat53 libavformat-dev
libgstreamer0.10-0-dbg libgstreamer0.10-0
libgstreamer0.10-dev libxine1-ffmpeg libxine-dev
libxine1-bin libunicap2 libunicap2-dev swig libv4l-0
libv4l-dev python-numpy libpython2.6 python-dev
python2.6-dev libgtk2.0-dev

Install Open CV (in case opencv 2.4.8):#wget
http://sourceforge.net/projects/opencvlibrary/files/ope
ncv-unix/2.4.8/opencv-2.4.8.zip/download opencv2.4.8.zipgit clone https://github.com/Itseez/opencv.git
Unzip and prepare for build#unzip opencv-2.4.8.zip#cd opencv-2.4.8#mkdir release#cd release#ccmake ../make(It will take About 1 hour):(Raspberry Pi 2 --- About 2hours):(Raspberry Pi --- About 7hours):
sudo make installThat’s all:

4.How to make the program in open
CV for Raspberry Pi
About the tracing picture with Web Camera inPython.
・Python install we need・Setting web camera for Raspberry Pi#lsusb※confirming the camera device
ExamplesBus 001 Device 005: ID 056e:7016 Elecom Co.,Ltd

#coding: utf-8#calling open CV
import cv2#the frame of camera
window Name=u’Camera’.encode(‘cp932’)
cv2.namedWindow(windowName)#calling camera picturesrc = cv2.VideoCapture (0)#It is better to deal with error about not being camera
If not src.isOpened():Print u ’We can’t read camera’
Import sys#reading camera, stoping ESC key when you want
while True:
retval, frame = src.read( )If frame is None:
break
Cv2.imshow(window.name, frame)
key = cv2.waitKey(33)If key == 27:
break
#End
cv2.destroyAllWindows()
src.release

Showing Performance Demo

Raspberry Pi Camera for open CV#raspi-config
In Display
1.Expand Filesystem
Enable support for Raspberry Pi camera?
→<Enable>#reboot

C++
raspicam_cv libraly

https://github.com/robidouille/robidouille/tree/master/raspic
am_cv
You can download# apt-get install git
raspberry pi userland# mkdir ~/git# cd ~/git# mkdir raspberrypi# cd raspberrypi# git clone https://github.com/raspberrypi/userland.git# cd userland# ./buildme

# cd ~/git# git clone https://github.com/robidouille/robidouille.git# cd robidouille/raspicam_cv
You have to revise as follows with vi editor and so on.
before： CFLAGS_OPENCV = -I/usr/include/opencv
after ： CFLAGS_OPENCV = -I/usr/local/include/opencv# mkdir objs
# make(You can use and play)#./raspicamtest -l → 640 x 480 picture size#./raspicamtest -x → 960 x 720 picture size#./raspicamtest→ 320 x 240 picture size

Showing Performance Demo5.How to use open CV for Raspberry Pi

Watching with display
Vnc, it’s better.
X11vnc is the best.
x11vnc command as follows#x11vnc -usepw
How to use open CV program#python [program files].py#./ [Compiled program files]

6.Extras (What is this ?)Compare face detect program
You can download・webcamera
https://gist.github.com/nikotan/1148913
and so on

・pi camera
http://meganezumi.seesaa.net/article/427934982.html
and so on

Showing Performance Demo
But I’ve done them mostly. ^^;7.Questions
Thank-you for all guys !