# data[].attributes.attachment_link.readable_text
I was inspired to try out the PlayStation 3 Eye camera for astrophotogaphy after seeing this amazing Orion M42 nebula image taken using a PS3 webcam on a SkyWatcher 130P (an hours worth of 4s exposures and a lot of post processing). Here's another nice thread on using the PlayStation 3 Eye camera with a telescope. It's reported to use an OV7725 60fps 6um pixel VGA sensor and image processor from Omnivision.

Actual test images pending - I need a clear night without other commitments.

Opening the case

This is surprisingly tricky. First, there are four screws on the back hidden behind glued on covers, which must be removed. Then the hard part - using a flat screwdriver or two, pop the seam all the way round. The main rectangular part of the casing is held by three clips (marked) which are quite easy, but there ball part is held by a pair of strong clips (also marked). This video from Peau Productions helped, but have a look at the full sized version of the images here to understand where the clips you are aiming for are.

Once the back of the case is removed, the base is easily freed by removing another pair of screws. I decided for telescope use to remove the heavy flat foot - but the screw holding this on didn't unscrew. In the end I used a hacksaw to free this - and once reassembled covered the slot with insulating tape.

Now just two screws must be removed to free the board, the most left and most right. Don't remove the lens holder unless you need to (in case you get it dirty), and likewise there is no point removing the microphone cover (held by three screws).

Thanks to other bloggers like this one, I knew there was a standard M12 board lens holder into which a ready made 1.25" nosepiece should screw in for use with a telescope. I also knew from post like this that least two variants of the PS3 Eye camera's lens and IR filter, often with lots of glue making disassembly hard.

Mine turned out to have the lens glued into the holder, so I simply unscrewed the mount and replaced it with the lens holder from a spare Xbox Live Vision webcam instead. Note that the PS3 mount has two small legs on opposite corners (with holes in the PCB to match), while the Xbox mount has two small legs on the non-screw sides. I just cut these off, so the mount is only held by the two screws. This made reattaching it a little harder, but shouldn't affect the stability.

Luckily this worked nicely with my existing 1.25" Astro Engineering AC378 nose-piece adapter, without having to cut away any of the PS3 Eye's casing. For a shorter height M12 board lens mount used, you may need a hacksaw to modify the case.

I've not shown the front casing and how to remove the original twisting lens covering (quite a clever design - the lens itself has a twist action for a wide-angle and zoom setting). The outer lens casing is retained via four clips - I removed it by bending one clip at a time and holding them open with small jewellers' screwdrivers as a wedge. This was a bit fiddly, so if you don't need this part a little force could just break these clips.

There is company doing Windows PS3 Eye drivers, but as I don't have a Windows machine at home anymore I didn't explore this.

Video for the PS3 Eye does not work out of the box on Mac OS X "Mountain Lion" 10.8, but the microphone does. Here's what it says at the command line:

$ system_profiler SPUSBDataType
...
USB Camera-B4.04.27.1:
Product ID: 0x2000
Vendor ID: 0x1415
Version: 1.00
Speed: Up to 480 Mb/sec
Manufacturer: OmniVision Technologies, Inc.
Location ID: 0xfa130000 / 6
Current Available (mA): 500
Current Required (mA): 500

According to these guys' detailed tear-down, that version string B4.04.27.1 matches this being a newer version with the OV538 USB chip (see photo above, unlike the older B3.04.06.1 with an OV534 chip). The serial number on the base is S/N 8X0066138, and says it is a SLEH-00201 manufactured by Namtai for Sony.

So, driver time - this should work with the Macam PS3 Eye driver, although they do warn about high bandwidth needs. I tried both macam.0.9.2.dmg (the current release), and the latest development build macam-cvs-build-2009-09-25.zip (several years old - not a good sign for the project's health), and while they could capture still images at VGA resolution (640 x 480 pixels), there was no live video and when trying to record video the PS3 Eye made the macam app crash.

This rules out using my nice light Mac laptop with the telescope and this camera :(

Linux includes drivers so this is very easy - it just works. However, on an older kernels the drivers are less functional (e.g. no choice of resolution or frame rate). The PS3 Eye camera even worked out of the box with Skype.

$ lsusb
... ID 1415:2000 Nam Tai E&E Products Ltd. or OmniVision Technologies, Inc. Sony Playstation Eye

However, wxAstroCapture didn't seen to recognise it. For now using guvcview gives some promising results in terms of control over gain/exposure.

Waiting for clear skies on a free evening... I'll update this post later.

The PS3 Eye's USB cable is almost exactly 2m long, quite useful for connecting a laptop to a camera on your telescope.

# data[].attributes.attachment_link.description
I was inspired to try out the PlayStation 3 Eye camera for astrophotogaphy after seeing this amazing Orion M42 nebula image taken using a PS3 webcam on a SkyWatcher 130P (an hours worth of 4s exposures and a lot of post processing). Here's another nice thread on using the PlayStation 3 Eye camera with a telescope.

# data[].attributes.attachment_link.title
How can I install pd-extended on Ubuntu 14.10?

# data[].attributes.attachment_link.description
Hi, The internet pointed me to this page: http://puredata.info/docs/faq/debian which has very clear instructions expect that the necessary directory doesn't exist for my version of Ubuntu, 14.10. In particular, the procedure adds the following line to my ...

# data[].attributes.attachment_link.keywords[]
download pure data computer music system free

# data[].attributes.attachment_link.description
Download Pure Data Computer Music System for free. The Pure Data (short Pd) project on SourceForge unifies the extensions (or externals) written for the Pure Data Graphical Computer Music System written by Miller Puckette with contributions from many others.

# data[].attributes.attachment_link.title
error on make with missing FTFont.h · Issue #193 · umlaeute/Gem

# data[].attributes.attachment_link.description
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../../src -I../../src -DGEM_INTERNAL -DGLEW_BUILD -DGLEW_MX -DPD -DPD -fPIC -I/usr/local/include/pd -g -O2 -freg-struct-return -O3 -falign-loops -falign-functions -falign-jumps -funroll-loops -...

# data[].attributes.attachment_link.readable_text
Thanks for contributing an answer to Stack Overflow!

Please be sure to answer the question. Provide details and share your research!

Asking for help, clarification, or responding to other answers.

Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.

# data[].attributes.attachment_link.title
compiling OpenGL program GL/glew.h missing

# data[].attributes.attachment_link.description
Thanks for contributing an answer to Stack Overflow! Please be sure to answer the question. Provide details and share your research! Asking for help, clarification, or responding to other answers. Making statements based on opinion; back them up with references or personal experience. To learn more, see our tips on writing great answers.

# data[].attributes.attachment_link.readable_text
What Is OpenGL?
OpenGL is a Graphics rendering API which is operating system independent, window system independent and has high-quality color images composed of geometric and image primitives.
OpenGL APIs can use following ...

Now lets see How to install OpenGL on out Ubuntu OS.

Now because GLUT (OpenGL Utility Toolkit) depends upon OpenGL and a number of other related libraries, if we install GLUT then OpenGL will be automatically be installed.

Run the following commands to install OpenGL.

Now to test if OpenGl libraries are working fine on our Linux, we will create a C++ program and test it.

So create a following C++ Program.

Now give the command below to compile your code.

Now run your OpenGl program with following command

OUTPUT:

If a window pops up when you run the program, then OpenGL is working on your Ubuntu OS.

# data[].attributes.attachment_link.description
What Is OpenGL? OpenGL is a Graphics rendering API which is operating system independent, window system independent and has high-quality color images composed of geometric and image primitives. OpenGL APIs can use following ... Now lets see How to install OpenGL on out Ubuntu OS.

# data[].attributes.attachment_link.readable_text
OpenCV released OpenCV-3.4.4 and OpenCV-4.0.0 on 20th November. There have been a lot of bug fixes and other changes in these versions. The release highlights are as follows:

OpenCV is now C++11 library and requires C++11-compliant compiler. Minimum required CMake version has been raised to 3.5.1.

A lot of C API from OpenCV 1.x has been removed.

Persistence (storing and loading structured data to/from XML, YAML or JSON) in the core module has been completely reimplemented in C++ and lost the C API as well.

New module G-API has been added, it acts as an engine for very efficient graph-based image procesing pipelines.

dnn module now includes experimental Vulkan backend and supports networks in ONNX format.

The popular Kinect Fusion algorithm has been implemented and optimized for CPU and GPU (OpenCL)
QR code detector and decoder have been added to the objdetect module.

Very efficient and yet high-quality DIS dense optical flow algorithm has been moved from opencv_contrib to the video module.

In this post, we will provide a bash script for installing OpenCV-3.4.4 (C++ and Python 3) on Ubuntu 18.04. We will also briefly study the script to understand what's going in it. Note that this script will install OpenCV in a local directory and not on the entire system.

Looking for installation script for OpenCV 3.4.4 on Ubuntu 16.04? Have a look at .

Step 0: Select OpenCV version to install

echo "OpenCV installation by learnOpenCV.com"

#Specify OpenCV version
cvVersion="3.4.4"

We are also going to clean build directories and create installation directory.

# Clean build directories
rm -rf opencv/build
rm -rf opencv_contrib/build

# Create directory for installation
mkdir installation
mkdir installation/OpenCV-"$cvVersion"

Finally, we will be storing the current working directory in cwd variable. We are also going to refer to this directory as OpenCV_Home_Dir throughout this blog.

# Save current working directory
cwd=$(pwd)

Step 1: Update Packages

sudo apt -y update
sudo apt -y upgrade

If you are still not able to install OpenCV on your system, but want to get started with it, we suggest using our docker images with pre-installed OpenCV, Dlib, miniconda and jupyter notebooks along with other dependencies as described in this blog.

Step 2: Install OS Libraries

sudo apt -y remove x264 libx264-dev

## Install dependencies
sudo apt -y install build-essential checkinstall cmake pkg-config yasm
sudo apt -y install git gfortran
sudo apt -y install libjpeg8-dev libpng-dev

sudo apt -y install software-properties-common
sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"
sudo apt -y update

sudo apt -y install libjasper1
sudo apt -y install libtiff-dev

sudo apt -y install libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev
sudo apt -y install libxine2-dev libv4l-dev
cd /usr/include/linux
sudo ln -s -f ../libv4l1-videodev.h videodev.h
cd "$cwd"

sudo apt -y install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
sudo apt -y install libgtk2.0-dev libtbb-dev qt5-default
sudo apt -y install libatlas-base-dev
sudo apt -y install libfaac-dev libmp3lame-dev libtheora-dev
sudo apt -y install libvorbis-dev libxvidcore-dev
sudo apt -y install libopencore-amrnb-dev libopencore-amrwb-dev
sudo apt -y install libavresample-dev
sudo apt -y install x264 v4l-utils

# Optional dependencies
sudo apt -y install libprotobuf-dev protobuf-compiler
sudo apt -y install libgoogle-glog-dev libgflags-dev
sudo apt -y install libgphoto2-dev libeigen3-dev libhdf5-dev doxygen

Looking for installation script for OpenCV 4 on Ubuntu 18.04? Have a look at .

Step 3: Install Python Libraries

sudo apt -y install python3-dev python3-pip python3-vev
sudo -H pip3 install -U pip numpy
sudo apt -y install python3-testresources

We are also going to install virtualenv and virtualenvwrapper modules to create Python virtual environment. We will also install dlib in the Python environment.

cd $cwd
############ For Python 3 ############
# create virtual environment
python3 -m venv OpenCV-"$cvVersion"-py3
echo "# Virtual Environment Wrapper" >> ~/.bashrc
echo "alias workoncv-$cvVersion=\"source $cwd/OpenCV-$cvVersion-py3/bin/activate\"" >> ~/.bashrc
source "$cwd"/OpenCV-"$cvVersion"-py3/bin/activate

# now install python libraries within this virtual environment
pip install wheel numpy scipy matplotlib scikit-image scikit-learn ipython dlib

# quit virtual environment
deactivate
######################################

If you are solely a Python user, it is easier to use pip install opencv-contrib-python==3.4.4.19.

Download Installation Script
To easily follow along this tutorial, please download installation script by clicking on the button below. It's FREE!

Step 4: Download opencv and opencv_contrib

git clone https://github.com/opencv/opencv.git
cd opencv
git checkout 3.4
cd ..

git clone https://github.com/opencv/opencv_contrib.git
cd opencv_contrib
git checkout 3.4
cd ..

Step 5: Compile and install OpenCV with contrib modules

First we navigate to the build directory.

cd opencv
mkdir build
cd build

Next, we start the compilation and installation process.

cmake -D CMAKE_BUILD_TYPE=RELEASE \
            -D CMAKE_INSTALL_PREFIX=$cwd/installation/OpenCV-"$cvVersion" \
            -D INSTALL_C_EXAMPLES=ON \
            -D INSTALL_PYTHON_EXAMPLES=ON \
            -D WITH_TBB=ON \
            -D WITH_V4L=ON \
            -D OPENCV_PYTHON3_INSTALL_PATH=$cwd/OpenCV-$cvVersion-py3/lib/python3.5/site-packages \
        -D WITH_QT=ON \
        -D WITH_OPENGL=ON \
        -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
        -D BUILD_EXAMPLES=ON ..

For system wide installation of OpenCV, change CMAKE_INSTALL_PREFIX to CMAKE_INSTALL_PREFIX=/usr/local \.

make -j4
make install

There are two ways to use OpenCV in C++, the preferred way is to use CMake, the other one being command line compilation using g++. We will have a look at both ways.

Using CMakeLists.txt
The basic structure of your CMakeLists.txt will stay the same. Only difference being, that you will have to set OpenCV_DIR as shown below.

SET(OpenCV_DIR <OpenCV_Home_Dir>/installation/OpenCV-3.4.4/share/OpenCV/)

Make sure that you replace OpenCV_Home_Dir with correct path. For example, in my case:

SET(OpenCV_DIR /home/hp/OpenCV_installation/installation/OpenCV-3.4.4/share/OpenCV/)

Once you have made your CMakeLists.txt, follow the steps given below.

mkdir build && cd build
cmake ..
cmake --build . --config Release

This will generate your executable file in build directory.
Using g++
To compile a sample file (let's say my_sample_file.cpp), use the following command.

g++ `pkg-config --cflags --libs <OpenCV_Home_Dir>/installation/OpenCV-3.4.4/lib/pkgconfig/opencv.pc` my_sample_file.cpp -o my_sample_file

To use the OpenCV version installed using Python script, first we activate the Python Virtual Environment.
For OpenCV-3.4.4 : Python 3
workon OpenCV-3.4.4-py3

Once you have activated the virtual environment, you can enter Python shell and test OpenCV version.

ipython
import cv2
print(cv2.__version__)

Hope this script proves to be useful for you :). We will be back with installation script for Windows. Stay tuned for more interesting stuff. In case of any queries, feel free to comment below and we will get back to you as soon as possible.

Subscribe & Download Code

If you liked this article and would like to download code (C++ and Python) and example images used in this post, please subscribe to our newsletter. You will also receive a free Computer Vision Resource Guide. In our newsletter, we share OpenCV tutorials and examples written in C++/Python, and Computer Vision and Machine Learning algorithms and news.
Subscribe Now

# data[].attributes.attachment_link.title
Install OpenCV 3.4.4 on Ubuntu 18.04 | Learn OpenCV

# data[].attributes.attachment_link.description
OpenCV released OpenCV-3.4.4 and OpenCV-4.0.0 on 20th November. There have been a lot of bug fixes and other changes in these versions. The release highlights are as follows: OpenCV is now C++11 library and requires C++11-compliant compiler. Minimum required CMake version has been raised to 3.5.1.

# data[].attributes.attachment_link.readable_text
Pure Data webcam basics

1. open up a new pure data project.

2. start by placing a "gemwin" object, this is the rendering window manager, you can add many attributed to it. we will start with the basics.

3. Add the "create, 1" and "destroy" message boxes, these will create the rendering window and destroy it, you cannot close the rendering window, it has to be closed with the destroy button.

4. Optionally you can give the window a dimension, let's say you want the Webcam to be shows in 720p, add a "dimen 1280 720" messagebox. but you have also have to change the size of the rectangle (see later)
Beware that you have to click the Dimen messagebox BEFORE you create the window

5. Next we will make the Gemhead object, this is a rendering chain, you can have multiple gemheads. like if you want 2 squares you will use 2 rendering chains.
Now we only need one, for the webcam

6. Connect the "gemhead" with a "pix_video". the "pix_" objects are used to define an input.. there's also pix_movie, pix_image...
"pix_video" is for webcam.

7. now the pix_video is in place, but there is no device selected, Pure data won't know which device to caputre from, we can choose our device by adding a "dialog" messagebox. if no devices are found you will get an error in the print window. always keep an eye on it.

8. The device is selected, the webcam is capturing, but the captured image isn't shown anywhere, this is because the pix_video isn't mapped onto a surface, to do that we will add a pix_texture.

9. the pix_video is now on a texture, now we only need to choose a surface for it to project on, this could be any object from PureData, like a rectangle, square, even a cube if you want it in 3D. we will use a Rectangle with a size of 4 by 3.

This is it! now you can click the dimensions button (you can change the dimensions as you like) and then hit the create, 1.

# data[].attributes.attachment_link.description
Pure Data webcam basics 1. open up a new pure data project. 2. start by placing a "gemwin" object, this is the rendering window manager, you can add many attributed to it. we will start with the basics. 3.

# data[].attributes.attachment_link.readable_text
In this blog post you will learn how to install OpenCV on Ubuntu 18.04.
In the past, I've authored a handful of installation guides for Ubuntu:

The folks at Canonical have been working hard.

On April 26, 2018, they've released a new Long Term Support (LTS) version of Ubuntu for the community: Ubuntu 18.04 LTS (Bionic Beaver).

Support for Ubuntu 16.04 LTS continues until April 2021 so rest-assured - you don't have to upgrade your 16.04 OS to continue working on your image processing projects.

That said, if you want to upgrade to Ubuntu 18.04 and use the latest-and-greatest, I think you'll be quite pleased with the new changes in Ubuntu 18.04.

Let's get down to business and install OpenCV with Python 3 bindings.
To learn how to stand up your Ubuntu 18.04 system with OpenCV, just keep reading.
Note: While you won't see an Ubuntu 17.10 specific guide here on my blog (non-LTS), these instructions may work with 17.10 (you'll just have to proceed at your own risk).

Ubuntu 18.04: How to install OpenCV
One major change in Ubuntu 18.04 is that they've dropped Python 2.7 completely.
You can still install Python 2.7 if-needed, but now Python 3 is the default on the OS.

Given that, this guide supports Python 3. If you need Python 2.7 support, read this entire guide first and then check the first question of the Troubleshooting your install (FAQ) section near the bottom of this blog post for some Python 2.7 pointers.

Step #0: Get comfortable - you'll be using Python 3.6

Let's familiarize ourselves with Python 3 on Ubuntu 18.04.

Let's see which version is installed on our system:

And now, let's launch a Python 3 shell just to test the waters:

That's easy enough, so let's get on with installing OpenCV on Ubuntu 18.04.

Step #1: Install OpenCV dependencies on Ubuntu 18.04

All steps today will be accomplished in the terminal/command line. Before we begin, open a terminal or connect via SSH.

From there, we need to refresh/upgrade the pre-installed packages/libraries with the apt-get package manager:

Followed by installing developer tools:

You most likely already have installed on Ubuntu 18.04, but be sure to include it in the install command for sanity.

Next, we need to install some OpenCV-specific prerequisites. OpenCV is an image processing/computer vision library and therefore it needs to be able to load standard image file formats such as JPEG, PNG, TIFF, etc. The following image I/O packages will allow OpenCV to work with image files:

Similarly, let's include video I/O packages as we often work with video on the PyImageSearch blog. You'll need the following packages so you can work with your camera stream and process video files:

OpenCV's highgui module relies on the GTK library for GUI operations. The highgui module will allow you to create elementary GUIs which display images, handle kepresses/mouse clicks, and create sliders and trackbars. Advanced GUIs should be built with TK, Wx, or QT. See this blog post to learn how to make an OpenCV GUI with TK.

Let's install GTK:

I always recommend the following two libraries which will optimize various OpenCV functions:

And finally, our last requirement is to install Python 3 headers and libraries:

Step #2: Download the official OpenCV source
Update 2018-12-20: These instructions have been updated to work with OpenCV 3.4.4. These instructions should continue to work with future OpenCV 3.x versions as well.
Note: If your browser is cutting off the full command either use the "<>" button in the toolbar above to expand the code block or copy and paste the following URL: https://github.com/opencv/opencv_contrib/archive/3.4.4.zip

So, what's the contrib repo?

The contrib repository contains algorithms such as SIFT, SURF, and others. In the past, these implementations were included in the default installation of OpenCV 2.4; however, they were moved beginning with OpenCV 3+.

Modules that are actively being developed and/or modules that are patented (not free for commercial/industry use) are included in the contrib module. SIFT and SURF fall into this category. You can learn more about the thought process behind this move in the following blog post: Where did SIFT and SURF go in OpenCV 3?
Important: Both opencv and opencv_contrib versions must be identical. Notice that both URLs point to 3.4.4. Feel free to install a different version while still using this guide - just be sure to update both URLs.
Now, let's unzip the archives:

Now let's go ahead and rename the directories:

Step #3: Configure your Python 3 environment

The first step we're taking to configure our Python 3 development environment is to install pip, a Python Package Manager.

To install pip, simply enter the following in your terminal:

Making use of virtual environments for Python development

If you are familiar with my blog and install guides therein, the following statement might make me sound like a broken record but I'll repeat it anyway:

I use both virtualenv and virtualenvwrapper daily and you should too unless you have a very specific reason not to. These two Python packages facilitate creating independent Python environments for your projects.
It is a best practice to use virtual environments.
Why?

Virtual environments allow you to work on your projects in isolation without spinning up resource hogs such as VMs and Docker images (I definitely do use both VirtualBox and Docker - they have their place).

For example, maybe you have a Python + OpenCV project that requires an older version of scikit-learn (v0.14) but you want to keep using the latest version of scikit-learn (0.19) for all of your newer projects.

Using virtual environments, you could handle these two software version dependencies separately, something that is not possible using just the system install of Python.

If you would like more information about Python virtual environments take a look at this article on RealPython or read the first half of the this blog post on PyImageSearch.

Let's go ahead and install virtualenv and virtualenvwrapper now:

To finish the install we need to update our file.

Using a terminal text editor such as vi / vim or nano , add the following lines to your :

Alternatively, you can append the lines directly via bash commands:

Next, source the file:

Creating a virtual environment to hold OpenCV and additional packages

Ok, while that may have seemed like a lot of work, we're at the point where we can create your Python 3 virtual environment for OpenCV:

Let's verify that we're in the cv environment by using the workon command:

Figure 2 shows what your terminal will look like (assuming you haven't changed any bash prompt settings):

Install NumPy in your environment

Step #4: Configure and compile OpenCV for Ubuntu 18.04

Now we're moving. We're ready to compile and install OpenCV.

Before we begin though, let's ensure that we're in the cv virtual environment:

It is very important that the virtual environment is active (you are "inside" the virtual environment) which is why I keep reiterating it. If you are not in the cv Python virtual environment before moving on to the next step your build files will not be generated properly.

Configure OpenCV with CMake

Update 2018-12-20: Be sure to set the flag so you'll have access to patented algorithms that we sometimes review on this blog (and cover in depth in PyImageSearch Gurus). Likewise, be sure to update the path to your virtual environment so that the correct PYTHON_EXECUTABLE will be used (notice cv in the path since our virtual environment name is cv ).

I always recommend that you scroll through the CMake output and check to see if anything looks out of the ordinary. You won't see a "YES" marked next to every setting - that is normal. Be sure you don't see any errors or your compile may fail (warnings are okay).

Take a moment to notice that only "Python 3" section is shown in the CMake output on Ubuntu 18.04 in Figure 3. This is by design as we are only compiling OpenCV with Python 3 support.
Update 2018-12-20: Additionally, scroll up about 20 lines and make sure "Non-free algorithms" is set to "YES".Note: If you are encountering problems related to stdlib .h : No such file or directory during either the cmake or make phase of this tutorial you'll also need to include the following option to CMake: - D ENABLE_PRECOMPILED_HEADERS = OFF . In this case I would suggest deleting your build directory, re-creating it, and then re-running cmake with the above option included. This will resolve the error.
Compiling OpenCV on Ubuntu 18.04

Depending on the number of processors/cores, you may be able to reduce compile time by altering the flag in the command. My computer has 4 cores, so I am using the - j4 flag. You can update the numeral or leave the flag off altogether:

This process may take 30 minutes or longer, so go for a nice walk if you are able.

If your compile chokes and hangs, it may be due to a threading race condition. In the event you run into this problem, simply delete your build directory, recreate it, and re-run cmake and make . This time do not include the flag next to make .

Installing and verifying OpenCV

Upon a successful, 100% complete compile you can now install OpenCV:

To verify the install, sometimes I like to enter the following command in the terminal:

Step #5: Finish your Python+ OpenCV + Ubuntu 18.04 install

We've reached the last lap of the race so stick with it.
Update 2018-12-20: The following paths have been updated. Previous versions of OpenCV installed the bindings in a different location ( / usr / local / lib / python3 . 6 / site - packages ), so be sure to take a look at the paths below carefully.
At this point, your Python 3 bindings for OpenCV should reside in the following folder:

Let's rename them to simply cv2 .so :
Pro-tip: If you are installing OpenCV 3 and OpenCV 4 alongside each other, instead of renaming the file to cv2.so, you might consider naming it and then in the next sub-step sym-link appropriately from that file to as well.
Our last sub-step is to sym-link our OpenCV cv2 .so bindings into our cv virtual environment:

Step #6: Testing your OpenCV 3 install on Ubuntu 18.04

The race is done, but let's verify that we're firing on all cylinders.

To verify that our OpenCV + Ubuntu install is complete, I like to launch Python, import OpenCV, and query for the version (this is useful for sanity if you have multiple versions of OpenCV installed as well):
Update 2018-12-20: I did not update the screenshot today during my update. The version should reflect the version of OpenCV you installed.
Here's what it looks like on my system:

Optionally, at this point, you can safely delete the zips and directories in your home folder:

Troubleshooting your install (FAQ)

In this section, I address some of the common questions, problems, and issues that arise when installing OpenCV 3 with Python 3 on Ubuntu 18.04 LTS.

Q. Where is Python 2.7 on Ubuntu 18.04?

A. Python 3 is the default and what comes with Ubuntu 18.04. Python 2.7 users can manually install Python 2.7 at the end of Step #1:

From there, when you create your virtual environment in Step #3, first install pip for Python 2.7:

And then (also in Step #3) when you make your virtual environment, simply use the relevant Python version flag:

From there everything should be the same.

Q. Why can't I just pip to install OpenCV?

A. There are a number of pip-installable versions of OpenCV available depending on your operating system and architecture. The problem you may run into is that they may be compiled without various optimizations, image I/O support, video I/O support, and opencv_contrib support. Use them - but use them at your own risk. This tutorial is meant to give you the full install of OpenCV on Ubuntu 18.04 while giving you complete control over the compile.

Q. When I execute mkvirtualenv or workon , I encounter a "command not found error".

A. There a number of reasons why you would be seeing this error message, all of come from to Step #3:

Q. When I open a new terminal, logout, or reboot my Ubuntu system, I cannot execute the mkvirtualenv or workon commands.

A. See #2 from the previous question.

Q. When I try to import OpenCV, I encounter this message: Import Error : No module named cv2 .

A. There are multiple reasons this could be happening and unfortunately, it is hard to diagnose. I recommend the following suggestions to help diagnose and resolve the error:

1. Make sure your cv virtual environment is active by using the command. If this command gives you an error, then see the first question in this FAQ.

2. As a last resort, check in your directory of your OpenCV build. There should be a file there (if both cmake and make executed without error). If the file is present,manually copy it into both the system directory as well as the directory for the cv virtual environment.

What's possible with OpenCV?

The possibilities with OpenCV are truly endless.

Perhaps you're interested in tracking object movement:

Or maybe you'd like to use OpenCV + deep learning to detect faces in images/video? Trust me, it's easier than it sounds!

Or maybe you're looking for a beginner-level book, designed for newcomers to the world of computer vision?

If so, look no further than my book, Practical Python and OpenCV + Case Studies.

Inside this book you'll:

Master the fundamentals of computer vision and image processing, taught on a fun, hands-on manner.

Learn by doing, including visual examples and lots of code (including line-by-line reviews, ensuring you understand exactly what's going on).

Implement case studies, including face detection, object tracking, handwriting recognition, and more!

To learn more about the book (and how it can help you learn computer vision + OpenCV), just click here!

Summary

Today we installed OpenCV 3 with Python 3 bindings on Ubuntu 18.04 LTS.

I hope you found these instructions helpful on getting your own Ubuntu 18.04 machine configured with OpenCV 3.

If you're interested in learning more about OpenCV, computer vision, and image processing, be sure to enter your email address in the form below to be notified when new blog posts + tutorials are published!

# data[].attributes.attachment_link.title
Ubuntu 18.04: How to install OpenCV - PyImageSearch

# data[].attributes.attachment_link.description
In this blog post you will learn how to install OpenCV on Ubuntu 18.04. In the past, I've authored a handful of installation guides for Ubuntu: The folks at Canonical have been working hard. On April 26, 2018, they've released a new Long Term Support (LTS) version of Ubuntu for the community: Ubuntu 18.04 LTS (Bionic Beaver).

# data[].attributes.attachment_link.readable_text
In this blog post you will learn how to install OpenCV on Ubuntu 18.04.
In the past, I've authored a handful of installation guides for Ubuntu:

The folks at Canonical have been working hard.

On April 26, 2018, they've released a new Long Term Support (LTS) version of Ubuntu for the community: Ubuntu 18.04 LTS (Bionic Beaver).

Support for Ubuntu 16.04 LTS continues until April 2021 so rest-assured - you don't have to upgrade your 16.04 OS to continue working on your image processing projects.

That said, if you want to upgrade to Ubuntu 18.04 and use the latest-and-greatest, I think you'll be quite pleased with the new changes in Ubuntu 18.04.

Let's get down to business and install OpenCV with Python 3 bindings.
To learn how to stand up your Ubuntu 18.04 system with OpenCV, just keep reading.
Note: While you won't see an Ubuntu 17.10 specific guide here on my blog (non-LTS), these instructions may work with 17.10 (you'll just have to proceed at your own risk).

Ubuntu 18.04: How to install OpenCV
One major change in Ubuntu 18.04 is that they've dropped Python 2.7 completely.
You can still install Python 2.7 if-needed, but now Python 3 is the default on the OS.

Given that, this guide supports Python 3. If you need Python 2.7 support, read this entire guide first and then check the first question of the Troubleshooting your install (FAQ) section near the bottom of this blog post for some Python 2.7 pointers.

Step #0: Get comfortable - you'll be using Python 3.6

Let's familiarize ourselves with Python 3 on Ubuntu 18.04.

Let's see which version is installed on our system:

And now, let's launch a Python 3 shell just to test the waters:

That's easy enough, so let's get on with installing OpenCV on Ubuntu 18.04.

Step #1: Install OpenCV dependencies on Ubuntu 18.04

All steps today will be accomplished in the terminal/command line. Before we begin, open a terminal or connect via SSH.

From there, we need to refresh/upgrade the pre-installed packages/libraries with the apt-get package manager:

Followed by installing developer tools:

You most likely already have installed on Ubuntu 18.04, but be sure to include it in the install command for sanity.

Next, we need to install some OpenCV-specific prerequisites. OpenCV is an image processing/computer vision library and therefore it needs to be able to load standard image file formats such as JPEG, PNG, TIFF, etc. The following image I/O packages will allow OpenCV to work with image files:

Similarly, let's include video I/O packages as we often work with video on the PyImageSearch blog. You'll need the following packages so you can work with your camera stream and process video files:

OpenCV's highgui module relies on the GTK library for GUI operations. The highgui module will allow you to create elementary GUIs which display images, handle kepresses/mouse clicks, and create sliders and trackbars. Advanced GUIs should be built with TK, Wx, or QT. See this blog post to learn how to make an OpenCV GUI with TK.

Let's install GTK:

I always recommend the following two libraries which will optimize various OpenCV functions:

And finally, our last requirement is to install Python 3 headers and libraries:

Step #2: Download the official OpenCV source
Update 2018-12-20: These instructions have been updated to work with OpenCV 3.4.4. These instructions should continue to work with future OpenCV 3.x versions as well.
Note: If your browser is cutting off the full command either use the "<>" button in the toolbar above to expand the code block or copy and paste the following URL: https://github.com/opencv/opencv_contrib/archive/3.4.4.zip

So, what's the contrib repo?

The contrib repository contains algorithms such as SIFT, SURF, and others. In the past, these implementations were included in the default installation of OpenCV 2.4; however, they were moved beginning with OpenCV 3+.

Modules that are actively being developed and/or modules that are patented (not free for commercial/industry use) are included in the contrib module. SIFT and SURF fall into this category. You can learn more about the thought process behind this move in the following blog post: Where did SIFT and SURF go in OpenCV 3?
Important: Both opencv and opencv_contrib versions must be identical. Notice that both URLs point to 3.4.4. Feel free to install a different version while still using this guide - just be sure to update both URLs.
Now, let's unzip the archives:

Now let's go ahead and rename the directories:

Step #3: Configure your Python 3 environment

The first step we're taking to configure our Python 3 development environment is to install pip, a Python Package Manager.

To install pip, simply enter the following in your terminal:

Making use of virtual environments for Python development

If you are familiar with my blog and install guides therein, the following statement might make me sound like a broken record but I'll repeat it anyway:

I use both virtualenv and virtualenvwrapper daily and you should too unless you have a very specific reason not to. These two Python packages facilitate creating independent Python environments for your projects.
It is a best practice to use virtual environments.
Why?

Virtual environments allow you to work on your projects in isolation without spinning up resource hogs such as VMs and Docker images (I definitely do use both VirtualBox and Docker - they have their place).

For example, maybe you have a Python + OpenCV project that requires an older version of scikit-learn (v0.14) but you want to keep using the latest version of scikit-learn (0.19) for all of your newer projects.

Using virtual environments, you could handle these two software version dependencies separately, something that is not possible using just the system install of Python.

If you would like more information about Python virtual environments take a look at this article on RealPython or read the first half of the this blog post on PyImageSearch.

Let's go ahead and install virtualenv and virtualenvwrapper now:

To finish the install we need to update our file.

Using a terminal text editor such as vi / vim or nano , add the following lines to your :

Alternatively, you can append the lines directly via bash commands:

Next, source the file:

Creating a virtual environment to hold OpenCV and additional packages

Ok, while that may have seemed like a lot of work, we're at the point where we can create your Python 3 virtual environment for OpenCV:

Let's verify that we're in the cv environment by using the workon command:

Figure 2 shows what your terminal will look like (assuming you haven't changed any bash prompt settings):

Install NumPy in your environment

Step #4: Configure and compile OpenCV for Ubuntu 18.04

Now we're moving. We're ready to compile and install OpenCV.

Before we begin though, let's ensure that we're in the cv virtual environment:

It is very important that the virtual environment is active (you are "inside" the virtual environment) which is why I keep reiterating it. If you are not in the cv Python virtual environment before moving on to the next step your build files will not be generated properly.

Configure OpenCV with CMake

Update 2018-12-20: Be sure to set the flag so you'll have access to patented algorithms that we sometimes review on this blog (and cover in depth in PyImageSearch Gurus). Likewise, be sure to update the path to your virtual environment so that the correct PYTHON_EXECUTABLE will be used (notice cv in the path since our virtual environment name is cv ).

I always recommend that you scroll through the CMake output and check to see if anything looks out of the ordinary. You won't see a "YES" marked next to every setting - that is normal. Be sure you don't see any errors or your compile may fail (warnings are okay).

Take a moment to notice that only "Python 3" section is shown in the CMake output on Ubuntu 18.04 in Figure 3. This is by design as we are only compiling OpenCV with Python 3 support.
Update 2018-12-20: Additionally, scroll up about 20 lines and make sure "Non-free algorithms" is set to "YES".Note: If you are encountering problems related to stdlib .h : No such file or directory during either the cmake or make phase of this tutorial you'll also need to include the following option to CMake: - D ENABLE_PRECOMPILED_HEADERS = OFF . In this case I would suggest deleting your build directory, re-creating it, and then re-running cmake with the above option included. This will resolve the error.
Compiling OpenCV on Ubuntu 18.04

Depending on the number of processors/cores, you may be able to reduce compile time by altering the flag in the command. My computer has 4 cores, so I am using the - j4 flag. You can update the numeral or leave the flag off altogether:

This process may take 30 minutes or longer, so go for a nice walk if you are able.

If your compile chokes and hangs, it may be due to a threading race condition. In the event you run into this problem, simply delete your build directory, recreate it, and re-run cmake and make . This time do not include the flag next to make .

Installing and verifying OpenCV

Upon a successful, 100% complete compile you can now install OpenCV:

To verify the install, sometimes I like to enter the following command in the terminal:

Step #5: Finish your Python+ OpenCV + Ubuntu 18.04 install

We've reached the last lap of the race so stick with it.
Update 2018-12-20: The following paths have been updated. Previous versions of OpenCV installed the bindings in a different location ( / usr / local / lib / python3 . 6 / site - packages ), so be sure to take a look at the paths below carefully.
At this point, your Python 3 bindings for OpenCV should reside in the following folder:

Let's rename them to simply cv2 .so :
Pro-tip: If you are installing OpenCV 3 and OpenCV 4 alongside each other, instead of renaming the file to cv2.so, you might consider naming it and then in the next sub-step sym-link appropriately from that file to as well.
Our last sub-step is to sym-link our OpenCV cv2 .so bindings into our cv virtual environment:

Step #6: Testing your OpenCV 3 install on Ubuntu 18.04

The race is done, but let's verify that we're firing on all cylinders.

To verify that our OpenCV + Ubuntu install is complete, I like to launch Python, import OpenCV, and query for the version (this is useful for sanity if you have multiple versions of OpenCV installed as well):
Update 2018-12-20: I did not update the screenshot today during my update. The version should reflect the version of OpenCV you installed.
Here's what it looks like on my system:

Optionally, at this point, you can safely delete the zips and directories in your home folder:

Troubleshooting your install (FAQ)

In this section, I address some of the common questions, problems, and issues that arise when installing OpenCV 3 with Python 3 on Ubuntu 18.04 LTS.

Q. Where is Python 2.7 on Ubuntu 18.04?

A. Python 3 is the default and what comes with Ubuntu 18.04. Python 2.7 users can manually install Python 2.7 at the end of Step #1:

From there, when you create your virtual environment in Step #3, first install pip for Python 2.7:

And then (also in Step #3) when you make your virtual environment, simply use the relevant Python version flag:

From there everything should be the same.

Q. Why can't I just pip to install OpenCV?

A. There are a number of pip-installable versions of OpenCV available depending on your operating system and architecture. The problem you may run into is that they may be compiled without various optimizations, image I/O support, video I/O support, and opencv_contrib support. Use them - but use them at your own risk. This tutorial is meant to give you the full install of OpenCV on Ubuntu 18.04 while giving you complete control over the compile.

Q. When I execute mkvirtualenv or workon , I encounter a "command not found error".

A. There a number of reasons why you would be seeing this error message, all of come from to Step #3:

Q. When I open a new terminal, logout, or reboot my Ubuntu system, I cannot execute the mkvirtualenv or workon commands.

A. See #2 from the previous question.

Q. When I try to import OpenCV, I encounter this message: Import Error : No module named cv2 .

A. There are multiple reasons this could be happening and unfortunately, it is hard to diagnose. I recommend the following suggestions to help diagnose and resolve the error:

1. Make sure your cv virtual environment is active by using the command. If this command gives you an error, then see the first question in this FAQ.

2. As a last resort, check in your directory of your OpenCV build. There should be a file there (if both cmake and make executed without error). If the file is present,manually copy it into both the system directory as well as the directory for the cv virtual environment.

What's possible with OpenCV?

The possibilities with OpenCV are truly endless.

Perhaps you're interested in tracking object movement:

Or maybe you'd like to use OpenCV + deep learning to detect faces in images/video? Trust me, it's easier than it sounds!

Or maybe you're looking for a beginner-level book, designed for newcomers to the world of computer vision?

If so, look no further than my book, Practical Python and OpenCV + Case Studies.

Inside this book you'll:

Master the fundamentals of computer vision and image processing, taught on a fun, hands-on manner.

Learn by doing, including visual examples and lots of code (including line-by-line reviews, ensuring you understand exactly what's going on).

Implement case studies, including face detection, object tracking, handwriting recognition, and more!

To learn more about the book (and how it can help you learn computer vision + OpenCV), just click here!

Summary

Today we installed OpenCV 3 with Python 3 bindings on Ubuntu 18.04 LTS.

I hope you found these instructions helpful on getting your own Ubuntu 18.04 machine configured with OpenCV 3.

If you're interested in learning more about OpenCV, computer vision, and image processing, be sure to enter your email address in the form below to be notified when new blog posts + tutorials are published!

# data[].attributes.attachment_link.title
Ubuntu 18.04: How to install OpenCV - PyImageSearch

# data[].attributes.attachment_link.description
In this blog post you will learn how to install OpenCV on Ubuntu 18.04. In the past, I've authored a handful of installation guides for Ubuntu: The folks at Canonical have been working hard. On April 26, 2018, they've released a new Long Term Support (LTS) version of Ubuntu for the community: Ubuntu 18.04 LTS (Bionic Beaver).

# data[].attributes.attachment_link.readable_text
OpenCV released OpenCV-3.4.4 and OpenCV-4.0.0 on 20th November. There have been a lot of bug fixes and other changes in these versions. The release highlights are as follows:

OpenCV is now C++11 library and requires C++11-compliant compiler. Minimum required CMake version has been raised to 3.5.1.

A lot of C API from OpenCV 1.x has been removed.

Persistence (storing and loading structured data to/from XML, YAML or JSON) in the core module has been completely reimplemented in C++ and lost the C API as well.

New module G-API has been added, it acts as an engine for very efficient graph-based image procesing pipelines.

dnn module now includes experimental Vulkan backend and supports networks in ONNX format.

The popular Kinect Fusion algorithm has been implemented and optimized for CPU and GPU (OpenCL)
QR code detector and decoder have been added to the objdetect module.

Very efficient and yet high-quality DIS dense optical flow algorithm has been moved from opencv_contrib to the video module.

In this post, we will provide a bash script for installing OpenCV-3.4.4 (C++ and Python 3) on Ubuntu 18.04. We will also briefly study the script to understand what's going in it. Note that this script will install OpenCV in a local directory and not on the entire system.

Looking for installation script for OpenCV 3.4.4 on Ubuntu 16.04? Have a look at .

Step 0: Select OpenCV version to install

echo "OpenCV installation by learnOpenCV.com"

#Specify OpenCV version
cvVersion="3.4.4"

We are also going to clean build directories and create installation directory.

# Clean build directories
rm -rf opencv/build
rm -rf opencv_contrib/build

# Create directory for installation
mkdir installation
mkdir installation/OpenCV-"$cvVersion"

Finally, we will be storing the current working directory in cwd variable. We are also going to refer to this directory as OpenCV_Home_Dir throughout this blog.

# Save current working directory
cwd=$(pwd)

Step 1: Update Packages

sudo apt -y update
sudo apt -y upgrade

If you are still not able to install OpenCV on your system, but want to get started with it, we suggest using our docker images with pre-installed OpenCV, Dlib, miniconda and jupyter notebooks along with other dependencies as described in this blog.

Step 2: Install OS Libraries

sudo apt -y remove x264 libx264-dev

## Install dependencies
sudo apt -y install build-essential checkinstall cmake pkg-config yasm
sudo apt -y install git gfortran
sudo apt -y install libjpeg8-dev libpng-dev

sudo apt -y install software-properties-common
sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"
sudo apt -y update

sudo apt -y install libjasper1
sudo apt -y install libtiff-dev

sudo apt -y install libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev
sudo apt -y install libxine2-dev libv4l-dev
cd /usr/include/linux
sudo ln -s -f ../libv4l1-videodev.h videodev.h
cd "$cwd"

sudo apt -y install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
sudo apt -y install libgtk2.0-dev libtbb-dev qt5-default
sudo apt -y install libatlas-base-dev
sudo apt -y install libfaac-dev libmp3lame-dev libtheora-dev
sudo apt -y install libvorbis-dev libxvidcore-dev
sudo apt -y install libopencore-amrnb-dev libopencore-amrwb-dev
sudo apt -y install libavresample-dev
sudo apt -y install x264 v4l-utils

# Optional dependencies
sudo apt -y install libprotobuf-dev protobuf-compiler
sudo apt -y install libgoogle-glog-dev libgflags-dev
sudo apt -y install libgphoto2-dev libeigen3-dev libhdf5-dev doxygen

Looking for installation script for OpenCV 4 on Ubuntu 18.04? Have a look at .

Step 3: Install Python Libraries

sudo apt -y install python3-dev python3-pip python3-vev
sudo -H pip3 install -U pip numpy
sudo apt -y install python3-testresources

We are also going to install virtualenv and virtualenvwrapper modules to create Python virtual environment. We will also install dlib in the Python environment.

cd $cwd
############ For Python 3 ############
# create virtual environment
python3 -m venv OpenCV-"$cvVersion"-py3
echo "# Virtual Environment Wrapper" >> ~/.bashrc
echo "alias workoncv-$cvVersion=\"source $cwd/OpenCV-$cvVersion-py3/bin/activate\"" >> ~/.bashrc
source "$cwd"/OpenCV-"$cvVersion"-py3/bin/activate

# now install python libraries within this virtual environment
pip install wheel numpy scipy matplotlib scikit-image scikit-learn ipython dlib

# quit virtual environment
deactivate
######################################

If you are solely a Python user, it is easier to use pip install opencv-contrib-python==3.4.4.19.

Download Installation Script
To easily follow along this tutorial, please download installation script by clicking on the button below. It's FREE!

Step 4: Download opencv and opencv_contrib

git clone https://github.com/opencv/opencv.git
cd opencv
git checkout 3.4
cd ..

git clone https://github.com/opencv/opencv_contrib.git
cd opencv_contrib
git checkout 3.4
cd ..

Step 5: Compile and install OpenCV with contrib modules

First we navigate to the build directory.

cd opencv
mkdir build
cd build

Next, we start the compilation and installation process.

cmake -D CMAKE_BUILD_TYPE=RELEASE \
            -D CMAKE_INSTALL_PREFIX=$cwd/installation/OpenCV-"$cvVersion" \
            -D INSTALL_C_EXAMPLES=ON \
            -D INSTALL_PYTHON_EXAMPLES=ON \
            -D WITH_TBB=ON \
            -D WITH_V4L=ON \
            -D OPENCV_PYTHON3_INSTALL_PATH=$cwd/OpenCV-$cvVersion-py3/lib/python3.5/site-packages \
        -D WITH_QT=ON \
        -D WITH_OPENGL=ON \
        -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
        -D BUILD_EXAMPLES=ON ..

For system wide installation of OpenCV, change CMAKE_INSTALL_PREFIX to CMAKE_INSTALL_PREFIX=/usr/local \.

make -j4
make install

There are two ways to use OpenCV in C++, the preferred way is to use CMake, the other one being command line compilation using g++. We will have a look at both ways.

Using CMakeLists.txt
The basic structure of your CMakeLists.txt will stay the same. Only difference being, that you will have to set OpenCV_DIR as shown below.

SET(OpenCV_DIR <OpenCV_Home_Dir>/installation/OpenCV-3.4.4/share/OpenCV/)

Make sure that you replace OpenCV_Home_Dir with correct path. For example, in my case:

SET(OpenCV_DIR /home/hp/OpenCV_installation/installation/OpenCV-3.4.4/share/OpenCV/)

Once you have made your CMakeLists.txt, follow the steps given below.

mkdir build && cd build
cmake ..
cmake --build . --config Release

This will generate your executable file in build directory.
Using g++
To compile a sample file (let's say my_sample_file.cpp), use the following command.

g++ `pkg-config --cflags --libs <OpenCV_Home_Dir>/installation/OpenCV-3.4.4/lib/pkgconfig/opencv.pc` my_sample_file.cpp -o my_sample_file

To use the OpenCV version installed using Python script, first we activate the Python Virtual Environment.
For OpenCV-3.4.4 : Python 3
workon OpenCV-3.4.4-py3

Once you have activated the virtual environment, you can enter Python shell and test OpenCV version.

ipython
import cv2
print(cv2.__version__)

Hope this script proves to be useful for you :). We will be back with installation script for Windows. Stay tuned for more interesting stuff. In case of any queries, feel free to comment below and we will get back to you as soon as possible.

Subscribe & Download Code

If you liked this article and would like to download code (C++ and Python) and example images used in this post, please subscribe to our newsletter. You will also receive a free Computer Vision Resource Guide. In our newsletter, we share OpenCV tutorials and examples written in C++/Python, and Computer Vision and Machine Learning algorithms and news.
Subscribe Now

# data[].attributes.attachment_link.title
Install OpenCV 3.4.4 on Ubuntu 18.04 | Learn OpenCV

# data[].attributes.attachment_link.description
OpenCV released OpenCV-3.4.4 and OpenCV-4.0.0 on 20th November. There have been a lot of bug fixes and other changes in these versions. The release highlights are as follows: OpenCV is now C++11 library and requires C++11-compliant compiler. Minimum required CMake version has been raised to 3.5.1.

# data[].attributes.attachment_link.title
Supercharging the PlayStation Eye - OpenCV 3 Blueprints

# data[].attributes.attachment_link.description
Supercharging the PlayStation EyeSony developed the Eye camera in 2007 as an input device f...

# data[].attributes.attachment_link.readable_text
From Tekkotsu Wiki

Only for Ubuntu 10.04. Do not use for later releases.

For general information about the webcam, see the Sony PlayStation Eye Webcam page.

Important Notes

1. The driver is only for systems running Ubuntu 10.04. You do not need to install anything if you're running Ubuntu 12.04 or higher because they use newer drivers.

2. This corrected version of the Ubuntu 10.04 ov534 camera driver is required to access essential camera options such as HFlip, VFlip, and gain control. If you do not install this driver, you will still be able to get camera images, but on a CalliopeSP or Calliope2SP robot they will be upside-down.

3. Even if you've previously installed this driver, if you update your system software (via "apt-get dist-upgrade" or "update-manager") and receive a new release of the Linux kernel, the system will revert to the standard driver and you will have to follow these steps again. To check your kernel release, do "uname -r"; you will see a string such as 2.6.32-41-generic. If after an update the string changes to 2.6.32-42-generic, you will need to reinstall this driver.

Checking Your Driver Version

To see what version of the driver is currently installed, do:

modinfo gspca-ov534

You should see a description line that includes "Tekkotsu", e.g.,

description:    GSPCA/OV534 USB Camera Driver(kaswy mod for MT use V0.5 / bear24rw patch V0.1) / ebrahimi patch V0.1+ Tekkotsu

If you don't see this, then you are running the standard driver, not the modified one, and you will need to follow the install procedure below to get the modified driver required by Tekkotsu.

Installing the Driver

The instructions below will guide you through replacing the standard OV534 device driver with a better one, and installing it into your running kernel. Cut and paste them into a shell. Do not try to type them in by hand because a simple mistake could cause you grief.

1. Upgrade to the latest kernel. Go to System > Administration > Update Manager and see if "kernel" or "linux-image" is listed as a pending update. If so, install that update. Better yet, install all pending updates. Then reboot the machine.

2. Get the Linux kernel source and a video utility:

sudo -s
cd /usr/src
apt-get update
apt-get install -y build-essential kernel-package linux-source guvcview
tar --bzip2 -xvf linux-source-*.tar.bz2
ln -s `find . -maxdepth 1 -type d -name "linux-source-*"` linux

3. Replace the driver source. This version of the driver has been patched to make videomode 0 (640x480 @ 15 fps) the default.

cd /usr/src/linux/drivers/media/video/gspca
mv ov534.c ov534.c.original
wget -Nhttp://Chiara-Robot.org/download/ov534/src/ov534.c

4. Rebuild the driver modules ov534, gspca_ov534, and gspca-main:

cd /usr/src
cp -p linux-headers-$(uname -r)/Module.symvers linux

cd /usr/src/linux
make oldconfig
make modules_prepare
make SUBDIRS=drivers/media/video/gspca modules

5. Install the new gspca_ov534 driver, which also requires replacing gspca_main:

cd /lib/modules/$(uname -r)/kernel/drivers/media/video/gspca
mv gspca_ov534.ko gspca_ov534.ko.original
mv gspca_main.ko gspca_main.ko.original
cd /usr/src/linux/drivers/media/video/gspca
cp -p gspca_main.ko /lib/modules/$(uname -r)/kernel/drivers/media/video/gspca
cp -p gspca_ov534.ko /lib/modules/$(uname -r)/kernel/drivers/media/video/gspca

cd /lib/modules
depmod `uname -r`

6. Kill Tekkotsu if it's running. Unplug the camera. Then to remove the old drivers and load the new ones, do:

modprobe -r gspca_ov534 gspca_main
modprobe gspca_ov534

7. To test whether the driver was installed correctly, do this:

 modinfo gspca_ov534

The result should include a "description" line that ends in "+ Tekkotsu", like this:

description:    GSPCA/OV534 USB Camera Driver(kaswy mod for MT use V0.5 / bear24rw patch V0.1) / ebrahimi patch V0.1 + Tekkotsu

Note: Tekkotsu now uses 640x480 resolution at 15 fps by default. The camera can deliver 320x240 pixel images at 125 frames per second, eliminating motion blur. If you want to experiment with this high frame rate you can either patch the driver to make the default videomode be 16 instead of 0, or set it manually by:

modprobe -r gspca_ov534
modprobe gspca_ov534 videomode=16

Installing the Udev Rules

If your netbook has a built-in webcam, it will fight with the Sony Playstation Eye for who gets to be /dev/video0 and who gets to be /dev/video1. If it has no webcam then the Eye will be /dev/video0, but Tekkotsu robots that use this camera assume it is /dev/video1. To prevent these problems you need to install udev rules to force the correct device assignment. See the article on Linux Udev Rules for instructions on downloading these rules.

There is a bug in Linux video driver support that causes the Sony Playstation Eye to come up as an audio device instead of a video device if a udev rule is applied to it. You can check this by doing:

ls -l /dev/video*

If you see "audio 116,9" instead of "video 81,1" then the bug has struck, and the camera will not work properly with Tekkotsu. The reload_ov534_driver.sh script supplied with the Tekkotsu Linux Udev Rules fixes this problem by doing:

sudo modprobe -r gspca_ov534
sudo modprobe gspca_ov534

So be sure to install the udev rules and scripts, or you will have to do the modprobes manually each time you boot the system or unplug and replug the camera.

You can use guvcview to test the camera and display the frame rate:

apt-get -y install guvcview

guvcview -d /dev/video1 -p 1

Set the Light Frequency Filter to 60 Hz to achieve the full 125 frames per second.

Tip from colleagues at Brown University: use guvcview's graphical controls to adjust white balance and exposure balance as needed.

Video Modes

Available modes are:

00: 640x480@15

01: 640x480@30

02: 640x480@40

03: 640x480@50

04: 640x480@60

10: 320x240@30

11: 320x240@40

12: 320x240@50

13: 320x240@60

14: 320x240@75

15: 320x240@100

16: 320x240@125

Recompiling Kernel Modules

Information about recompiling kernel modules can be found at linux.die.net

# data[].attributes.attachment_link.keywords[]
sony playstation eye driver install instructions

# data[].attributes.attachment_link.title
Sony PlayStation Eye driver install instructions

# data[].attributes.attachment_link.description
For general information about the webcam, see the Sony PlayStation Eye Webcam page. 1. The driver is only for systems running Ubuntu 10.04. You do not need to install anything if you're running Ubuntu 12.04 or higher because they use newer drivers. 2.

# data[].attributes.attachment_link.description
This project aims at providing a simple interface for capturing and viewing video from v4l2 devices, with a special emphasis for the linux uvc driver.

# data[].attributes.attachment_link.description
av7110 development repository (refactoring patch included)

# data[].attributes.attachment_link.description
You can browse the files in the CVS repository with viewcvs. You can also download on-the-fly generated tarballs, but please use this feature sparingly as it puts a high load on the machine. If you find yourself downloading the newest sources regularly you should consider using anon-cvs access, as described above.

# data[].attributes.attachment_link.readable_text
Tutorial kindly sent by Dino Magri (See his blog)
PS3 Eye
The ps3 Eye works in Ubuntu, although like it happens with other cameras the CCV does bnot recognize it (It happens with my USB built-in camera on both laptops). For that we have to install the library unicap and the driver gspca. First we download the latest version:

cd /home/user/
wget http://unicap-imaging.org/downloads/unicap-0.9.5.tar.gz

Uncompress the files:

tar -xvzf unicap-0.9.5.tar.gz

Download the patch (that we need to apply):

wget http://kaswy.free.fr/sites/default/files/download/ps3eye/unicap/unicap-gspca.patch

Before inatlling we need the packet, so just type:

sudo apt-get install patch
patch -p0 < unicap-gspca.patch

Now configuration followed by compilation:

cd /home/user/unicap-0.9.5
./configure
make
sudo make install

Done, CCV should be able to get the frames from PS3 driver.

# data[].attributes.attachment_link.title
Ps3eye in Ubuntu Tutorial - pedro lopes research

# data[].attributes.attachment_link.description
Tutorial kindly sent by Dino Magri (See his blog) PS3 Eye The ps3 Eye works in Ubuntu, although like it happens with other cameras the CCV does bnot recognize it (It happens with my USB built-in camera on both laptops). For that we have to install the library unicap and the driver gspca.