Installing OpenCV 2.4.8

The following post will help you download and install OpenCV 2.4.8 on Ubuntu14.04/13.10 without any difficulty or much indulgence , except for a few times when it asks for your password.

Just copy the following code and paste it in an editor(e.g. gedit) of your choice and save it under the name opencv.sh

version="$(wget -q -O - http://sourceforge.net/projects/opencvlibrary/files/opencv-unix | egrep -m1 -o '\"[0-9](\.[0-9])+' | cut -c2-)"
echo "Installing OpenCV" $version
mkdir OpenCV
cd OpenCV
echo "Removing any pre-installed ffmpeg and x264"
sudo apt-get -qq remove ffmpeg x264 libx264-dev
echo "Installing Dependenices"
sudo apt-get -qq install libopencv-dev build-essential checkinstall cmake pkg-config yasm libtiff4-dev libjpeg-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev python-dev python-numpy libtbb-dev libqt4-dev libgtk2.0-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils ffmpeg
echo "Downloading OpenCV" $version
wget -O OpenCV-$version.zip http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/$version/opencv-"$version".zip/download
echo "Installing OpenCV" $version
unzip OpenCV-$version.zip
cd opencv-$version
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..
make -j2
sudo make install
sudo sh -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'
sudo ldconfig
echo "OpenCV" $version "ready to be used"

Now using your terminal go to the directory where you have saved opencv.sh
and type:

chmod +x opencv.sh
./opencv.sh

If nothing goes wrong OpenCV is ready to be used!

Advertisements

Installing OpenCV in Ubuntu14.04(trusty)/13.10(saucy)

First, download the latest version of Open-CV from here : http://sourceforge.net/projects/opencvlibrary/files/latest/download

Now install the dependencies:

GCC :

 sudo apt-get install build-essential 

cmake:

 sudo apt-get install cmake 

Use Synaptic Package Manager to install these packages:
Python,Python-dev, Numpy, libavcodec-dev, libavformat-dev, libswscale-dev

Optional packages: libjpeg-dev, libpng-dev, libtiff-dev, libjasper-dev,lib1394 2.x

Now extract the opencv zip file and go to the extracted directory.

Next create a build directory and go into that:

 mkdir build
 cd build 

Next execute :

 
 cmake ../ 
 sudo make
 sudo make install 

If everything is done correctly Open-CV is installed and ready to work with.

Raspberry Pi as a WebServer

Having your own web-server is really awesome if it is as cheap and so much fun as it can be.

Here are the steps to make your very own raspberry pi.

You should have a Raspberry Pi with an SSH connection and a static IP for this to work.

(If you haven’t done so I will soon post how to!!)

To install Apache and PHP:

sudo apt-get install apache2 php5 libapache2-mod-php5

Now restart the service.

sudo service apache2 restart

Now go to the web-browser on your computer and enter the static IP of the PI.
If you get a message saying : “It Works”..
then it sure does.

You can also install MySQL:

sudo apt-get install mysql-server mysql-client php5-mysql

Using WiFi Adapter with Raspberry Pi

It is really tedious to have an Ethernet cable always hanging around with your R pi. A WiFi adapter helps in making the pi module more mobile.In this post I will describe how to use one.

Things you need to have before you can do this:

  • A working raspberry-pi which you can control via your computer or using a screen.
  • A WiFi Adapter

Adding WiFi adapter to the Raspberry Pi:
The WiFi adapter does not start working as soon as you connect it to the Pi. You are still going to need some other means of being able to control the Raspberry Pi either via a keyboard or remotely using a wired network connection.
If you do not have a working Raspberry Pi I will soon post how to setup one.
Configuring the WiFi network:
On the Raspberry Pi (and on Linux in general) we configure our network settings in the file “/etc/network/interfaces”. To edit this file use the following command:

sudo nano /etc/network/interfaces

This opens an editor called nano. It is a very simple text editor that is easy to approach and use.After opening the file in nano to configure your wireless network you want to modify the file such that it looks like the following:

auto lo
iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
auto wlan0

iface wlan0 inet dhcp
wpa-ssid "Your Network SSID"
wpa-psk "Your Password"

You will need to put your own SSID(network name) and password into the appropriate places.
To save the file and exit press Ctrl+X this will write the file to the disk . If nano asks if you want to Save modified buffer? press “Y” followed by hitting enter to confirm the filename.

At this point everything is configured – all we need to do is reload the network interfaces. This can be done by running the following command .

sudo service networking reload

After reloading the network interface (and re-connecting to the pi if you are using a remote connection) – you can now check the status of our WiFi connection by running:

ifconfig

The result should look something like this:

wlan0 Link encap:Ethernet HWaddr e8:4e:06:17:75:79
inet addr:192.168.0.102 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:134501 errors:0 dropped:173 overruns:0 frame:0
TX packets:72985 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:172631666 (164.6 MiB) TX bytes:6815325 (6.4 MiB)

If you see a valid IP address under “inet addr” you can now disconnect the network cable, and enjoy your freedom to move your Raspberry Pi around – because the WiFi connection is up and running!

SimpleCV with Raspberry Pi

This post is about installing SimpleCV onto your R pi .
First power up the pi and connect it to internet.
Next run the following command to install the necessary dependancies:
$sudo apt-get install ipython python-opencv python-scipy python-numpy python-setuptools python-pip

If you haven’t installed git you can do so by typing:

sudo apt-get install git

You can install SimpleCV from source.

mkdir ~/simplecv
cd ~/simplecv
git clone git://github.com/sightmachine/SimpleCV.git
cd SimpleCV
sudo pip install -r requirements.txt
sudo python setup.py develop

This will take a bit of time.
Next connect a compatible camera to the board input and open up the terminal.

raspberry@pi:~$ simplecv
SimpleCV:1> c = Camera()
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument

SimpleCV:2> c.getImage()
SimpleCV:2: 

SimpleCV:3> exit()

Congratulations, your RaspberryPi is now running SimpleCV!

Faceoff with LINUX

Patience,perseverance and prayer…….only these things can carry if you’ve decided to walk along this path.

I have just now installed Ubuntu 13.10 Saucy Salamander . It feels good once you’re done with the installation.

The next few posts will basically contain how to install and get things to work on Ubuntu 13.10.

As I get used to this stuff I will also post about other “Techno” stuff…

Thats all I have to say for now…. See you soon!