Hello everybody. I'm sorry for taking so long to answer you all. I didn't receive any notification of your comments here, so I had no idea this script wasn't working.
I've updated the script and now it works flawlessly on Ubuntu 17.04 (probably works on 16.04, 16.10 and 17.10 too, but I can't confirm). There were 2 problems:
1st - OpenCV2.4.13 makefile isn't compatible with GCC 6.x. OpenCV2.4.13.4 corrects it;
2nd - Python needs python-opencv package, and now I've included it in this script.
1st - OpenCV2.4.13 makefile isn't compatible with GCC 6.x. OpenCV2.4.13.4 corrects it;
2nd - Python needs python-opencv package, and now I've included it in this script.
![Opencv 4 ubuntu Opencv 4 ubuntu](/uploads/1/2/4/9/124930991/552649419.png)
![Install opencv 2.4.9 ubuntu 18 1 Install opencv 2.4.9 ubuntu 18 1](http://www.samontab.com/web/wp-content/uploads/2012/06/openCVConf1-300x243.png)
How to install OpenCV on Ubuntu or Debian. Home; Archive; Install OpenCV on Ubuntu or Debian. Install OpenCV on Ubuntu or Debian is a bit long but very easy.
Now answering your questions:
@vasu1765 - Sorry, I don't know the origin of your problem nor how to correct it. You probably already solved it (at least that's what I hope for), but I suggest you and everybody with a similar problem to uninstall opencv with
make uninstall
and rebuild it paying attention to warnings and error messages.@manish988@soumyadeep1997@wfs@MrNocTV@suresh88 - If your OpenCV2 build was successfull,
sudo apt-get install python-opencv
should fix it as @drsagitn pointed out (but avoid running this script and installing the opencv-python pip package).@tkotha@TeixeiraRafael@bharathkotari - Unfortunately I use OpenCV only to build other people's code and thus my OpenCV knowledge is scarse, so I have no idea :c
@jyothi2958 - The -fPIC build parameter is already in OpenCV2.4.13.4 makefile. I suggest that you remove your already built libs running
make uninstall
on your installation folder and rebuild opencv with the updated script.@eran-misi and @omar-JHA - ' # 2 cores' is a comment and thus anything after the hash is ignored by bash. Anyway, thanks for trying to help @jyothi2958 out :)
@Napoleon-BlownApart - checkinstall is included in the long dependency list. Maybe it's a good idea to use checkinstall but I don't know how to properly work with it. I've tried to do it in my last clean build (yesterday) of opencv and I believe I've made a f***-up running it. For an automated script, it's ideal that checkinstall command receives the needed parameters to create a .deb so the user isn't prompted to make decisions (it's error prune). When I learn how to properly work with it, I'll try to remember to come here and update the script.
As for libpng_dev, as far as I remember there was some incompatibility with OpenCV2.4.13 thus this script uses libpng12_dev. Maybe I'm mistaken, I really can't remember. And I have no idea about the impact of using or not libbb2. It probably won't hurt to include it.
As for libpng_dev, as far as I remember there was some incompatibility with OpenCV2.4.13 thus this script uses libpng12_dev. Maybe I'm mistaken, I really can't remember. And I have no idea about the impact of using or not libbb2. It probably won't hurt to include it.
@root-sudip - I'm not sure if it's possible to use OpenCV 2.4 wity python3. Every python3 build I've seen uses OpenCV3.
@DiwakarVartharajan - The pip package is not necessary.
sudo apt-get install python-opencv
only installs bindings for the OpenCV lib this script builds while pip install opencv-python
has bindings AND binaries (opencv core dynamic libs). If you run this script and install the pip package, it's possible that your build will have conflicting libs.@pab12play - OpenCV2.4.13.4 fixes it, so you don't need to downgrade your GCC anymore :)
@SportsMUST - Don't run it with sudo. It's possible (but not probable) that you'll need to chmod the script file to be able to run it. As for
fatal error: opencl_kernels.hpp: No such file or directory
error, I suggest you to use the updated script and make a clean build.@Piusha - The problem is that your machine has QT, but it's a version prior to 4.x and OpenCV2.4 requires QT 4.x. I believe running
apt-get install libqt4-core libqt4-dev libqt4-gui qt4-dev-tools
before running the updated script will solve your problem.@SutanuNandigrami - I believe your solution isn't necessary anymore as OpenCV2.4.13.4 corrects build bugs :)
If anyone else wants to reach me to discuss this script, please use @mentions. I believe that way I'll be notified of your messages :)