- Platforms
- Android
- ARM
- CUDA
- iOS
- OpenCL
- Become a Member
- OpenCV Installation on Ubuntu, macOS, Windows and Raspberry Pi
- 1. OpenCV Installation on Windows
- 2. OpenCV Installation on Ubuntu 16.04
- 3. OpenCV Installation on Ubuntu 18.04
- 4. OpenCV Installation on Red Hat
- 5. OpenCV Installation on CentOS 7
- 6. OpenCV Installation on macOS
- 7. OpenCV Installation on Raspberry Pi
- 7. OpenCV Docker Image
- Subscribe
- OpenCV behavior differences between Linux and Windows built application
- Thanks
- 3 Answers 3
Platforms
OpenCV was designed to be cross-platform. So, the library was written in C and this makes OpenCV portable to almost any commercial system, from PowerPC Macs to robotic dogs. Since version 2.0, OpenCV includes its traditional C interface as well as the new C++ one. For the most part, new OpenCV algorithms are now developed in C++. Also wrappers for languages such as Python and Java have been developed to encourage adoption by a wider audience. OpenCV runs on both desktop (Windows, Linux, Android, MacOS, FreeBSD, OpenBSD) and mobile (Android, Maemo, iOS).
Android
Since 2010 OpenCV was ported to the Android environment, it allows to use the full power of the library in mobile applications development.
ARM
Currently, most embedded devices use CPUs based on ARM architecture, including Cortex-A and Cortex-M series. Deep Learning algorithms are usually trained on x86/x64-based servers with powerful Nvidia GPUs. But then the inference needs to be performed on low-power ARM chips.
CUDA
In 2010 a new module that provides GPU acceleration was added to OpenCV. The ‘gpu’ module covers a significant part of the library’s functionality and is still in active development. It is implemented using CUDA and therefore benefits from the CUDA ecosystem, including libraries such as NPP (NVIDIA Performance Primitives). With the addition of CUDA acceleration to OpenCV, developers can run more accurate and sophisticated OpenCV algorithms in real-time on higher-resolution images while consuming less power.
iOS
In 2012 OpenCV development team actively worked on adding extended support for iOS. Full integration is available since version 2.4.2 (2012).
OpenCL
In 2011 a new module providing OpenCL™ accelerations of OpenCV algorithms was added to the library. This enabled OpenCV-based code taking advantage of heterogeneous hardware, in particular utilize potential of discrete and integrated GPUs. Since version 2.4.6 (2013) the official OpenCV WinMegaPack includes the ocl module.
In the 2.4 branch OpenCL-accelerated versions of functions and classes were located in a separate ocl module and in a separate namespace ( cv::ocl ), and often had different names (e.g. cv::resize() vs cv::ocl::resize() and cv::CascadeClassifier vs cv::ocl::OclCascadeClassifier ) that required a separate code branch in user application code. Since OpenCV 3.0 (master branch as of 2013) the OpenCL accelerated branches transparently added to the original API functions and are used automatically when possible/sensible.
Become a Member
Stay up to date on OpenCV and Computer Vision news
OpenCV Installation on Ubuntu, macOS, Windows and Raspberry Pi
In this post we provide OpenCV Installation instructions on different Operating Systems. This post is regularly updated to include instructions for the latest version of OpenCV.
This post is divided into the following sections. Each section will have the link to the corresponding blog for installation of OpenCV 3.4.4 or OpenCV 4.0.0 on an Operating System. Jump to the appropriate section by clicking on the link below
1. OpenCV Installation on Windows
Become an expert in Computer Vision, Machine Learning, and AI in 12-weeks! Check out our course
2. OpenCV Installation on Ubuntu 16.04
3. OpenCV Installation on Ubuntu 18.04
4. OpenCV Installation on Red Hat
5. OpenCV Installation on CentOS 7
6. OpenCV Installation on macOS
7. OpenCV Installation on Raspberry Pi
7. OpenCV Docker Image
Subscribe
If you liked this article, please subscribe to our newsletter. You will also receive a free Computer Vision Resource guide. In our newsletter, we share Computer Vision, Machine Learning and AI tutorials written in Python and C++ using OpenCV, Dlib, Keras, Tensorflow, CoreML, and Caffe.
OpenCV behavior differences between Linux and Windows built application
I have an application that I wrote and tested in Windows that uses OpenCV for image evaluation. It uses OpenCV 3.1.0 and was compiled with MinGW-W64 5.3.0. Now, I’ve cloned this application and built and tested it in a Linux environment. I did it on a Raspberry Pi first (Raspian Jessie) and then I did it on my laptop (Ubuntu 16.04, g++ 5.4.0). I evaluated the same images and got different results. There’s too much code for me to post and expect everyone to sort through, so my basic question is, is there something I should specifically look for? Right now I am debugging it on my laptop in Ubuntu, but if somebody had similar experience in the past and knew something to look for immediately it could save me some time.
Thanks
cv::cvtColor cv::Blur cv::Canny cv::FindContours cv::fitLine cv::fitEllipse
3 Answers 3
Image loading could be the one of the case. Please try to match the pixel values in windows & linux or mac after imread . Based on different version & codecs installed on machine it can vary little. This pixel values mis-match can happen for compressed image format like jpg, png, tiff etc. It should not happen for uncompressed format like pgm, bmp or in raw format. Please read the following lines from opencv documentation:
1/ The function determines the type of an image by the content, not by the file extension.
2/ On Microsoft Windows OS and MacOSX, the codecs shipped with an OpenCV image (libjpeg, libpng, libtiff, and libjasper) are used by default. So, OpenCV can always read JPEGs, PNGs, and TIFFs. On MacOSX, there is also an option to use native MacOSX image readers. But beware that currently these native image loaders give images with different pixel values because of the color management embedded into MacOSX.
3/ On Linux, BSD flavors and other Unix-like open-source operating systems, OpenCV looks for codecs supplied with an OS image. Install the relevant packages (do not forget the development files, for example, “libjpeg-dev”, in Debian and Ubuntu) to get the codec support or turn on the OPENCV_BUILD_3RDPARTY_LIBS flag in CMake.