Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenCV in Ubuntu 17.04

I had OpenCV installed in my Ubuntu machine running Ubuntu 16.10. Recently I updated to the latest Ubuntu 17.04 and OpenCV failed to work.

I am getting the following error.

ImportError: libjasper.so.1: cannot open shared object file: No such file or directory

I tried to install libjasper. With the command sudo apt-get install libjasper-dev

But I am getting the error E: Unable to locate package libjasper-dev

How can I fix it ?

like image 481
mjm Avatar asked Apr 19 '17 00:04

mjm


3 Answers

I found the answer here: https://github.com/opencv/opencv/issues/8622

sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"
sudo apt update
sudo apt install libjasper1 libjasper-dev

References to 17.04 packages no longer work.

like image 78
headdab Avatar answered Oct 22 '22 07:10

headdab


Installing the opencv library from the repository worked for me. Just both the following commands.

sudo apt-get install opencv-data 
sudo apt-get install libopencv-dev 

After installing that it worked as before. Previously I had build opencv myself. The one from the repository will work apparantely.

like image 25
mjm Avatar answered Oct 22 '22 07:10

mjm


libjasper-dev is not available for Ubuntu 17.04.

So you need to install the package from an earlier release. Try the following:

echo "deb http://us.archive.ubuntu.com/ubuntu/ yakkety universe" | sudo tee -a /etc/apt/sources.list

This will add a new line to the sources.list file in /etc/apt. It will allow installation of packages from 16.10.

You should be able to install the missing package libjasper-dev now with the following commands:

sudo apt-get update
sudo apt-get install libjasper-dev
like image 14
chittychitty Avatar answered Oct 22 '22 09:10

chittychitty