Questions tagged [opencv]

OpenCV (Open Source Computer Vision) is a library for real time computer vision. When using this tag, please add a language specific tag (python, c++, ...), if relevant.

OpenCV is a code library for Computer Vision related applications, spanning from many very basic tasks (capture and pre-processing of image data) to high-level algorithms (feature extraction, motion tracking, machine learning).

It is free software. Versions from 4.5.0 are licensed under the Apache 2 license, versions before that under the BSD 3-clause license. OpenCV provides a rich API in C++, Python, and Java. Third party wrappers are available. The library is platform-independent and often used for real-time image processing and computer vision (e.g. tracking in videos). It supports Windows, Linux, and OS X as well as Android (native and Java) and iOS.

OpenCV was officially launched by Intel in 1999. Version 2.0 (2009) was an important landmark as it introduced the new, comprehensive C++ interface, which since then is also to be used internally in the library. Since this release, OpenCV saw a strong acceleration of development in improving the library and adding new features. Version 3.0, released in 2015, deprecated the C API and emphasized object-oriented design for increased modularity and intuitive interface. More information may be found in Wikipedia.

Latest stable versions:

Homepage: https://opencv.org

Documentation: https://docs.opencv.org

Tutorials including source code:


Books

Note that this list is likely outdated and not vetted for quality. A book or course on computer vision in general, along with the official documentation of OpenCV, will give a better understanding of the matter and the library.

72729 questions
103
votes
5 answers

Setting Camera Parameters in OpenCV/Python

I am using OpenCV (2.4) and Python (2.7.3) with a USB camera from Thorlabs (DC1545M). I am doing some image analysis on a video stream and I would like to be able to change some of the camera parameters from my video stream. The confusing thing is…
Mike
  • 1,727
  • 3
  • 15
  • 25
101
votes
12 answers

What's 0xFF for in cv2.waitKey(1)?

I'm trying understand what 0xFF does under the hood in the following code snippet: if cv2.waitKey(0) & 0xFF == ord('q'): break Any ideas?
Dora
  • 1,163
  • 2
  • 9
  • 11
100
votes
4 answers

ConvergenceWarning: Liblinear failed to converge, increase the number of iterations

Running the code of linear binary pattern for Adrian. This program runs but gives the following warning: C:\Python27\lib\site-packages\sklearn\svm\base.py:922: ConvergenceWarning: Liblinear failed to converge, increase the number of iterations. …
Fahad Mairaj
  • 1,021
  • 2
  • 7
  • 7
100
votes
4 answers

How do I choose between Tesseract and OpenCV?

I recently came across Tesseract and OpenCV. It looks like Tesseract is a full-fledged OCR engine and OpenCV can be used as a framework to create an OCR application/service. I tried using Tesseract on some of my images and its accuracy seems…
Legend
  • 113,822
  • 119
  • 272
  • 400
100
votes
1 answer

What is different between all these OpenCV Python interfaces?

There are opencv (the library from the OpenCV guys), cv (the old library from the OpenCV guys) and pyopencv with its predecessor ctypes-opencv. What are the main differences and which one should I use?
Framester
  • 33,341
  • 51
  • 130
  • 192
97
votes
12 answers

OpenCV Python rotate image by X degrees around specific point

I'm having a hard time finding examples for rotating an image around a specific point by a specific (often very small) angle in Python using OpenCV. This is what I have so far, but it produces a very strange resulting image, but it is rotated…
Mike
  • 967
  • 1
  • 6
  • 8
97
votes
13 answers

iPhone and OpenCV

I know that OpenCV was ported to Mac OS X, however I did not find any info about a port to the iPhone. I am not a Mac developer, so that I do not know whether a Mac OS X port is enough for the iPhone. Does anyone know better than me?
Pascal T.
  • 3,866
  • 4
  • 33
  • 36
96
votes
7 answers

Combining Two Images with OpenCV

I'm trying to use OpenCV 2.1 to combine two images into one, with the two images placed adjacent to each other. In Python, I'm doing: import numpy as np, cv img1 = cv.LoadImage(fn1, 0) img2 = cv.LoadImage(fn2, 0) h1, w1 =…
Cerin
  • 60,957
  • 96
  • 316
  • 522
96
votes
10 answers

Installing OpenCV fails because it cannot find "skbuild"

I have a docker image that I need to install openCV in it and from yesterday it started to fail because it cannot find the "skbuild" module: Step 12/24 : RUN pip install opencv-python opencv-contrib-python ---> Running in a0f746a23aed Collecting…
AVarf
  • 4,481
  • 9
  • 47
  • 74
96
votes
17 answers

open cv error: (-215) scn == 3 || scn == 4 in function cvtColor

I'm currently in Ubuntu 14.04, using python 2.7 and cv2. When I run this code: import numpy as np import cv2 img = cv2.imread('2015-05-27-191152.jpg',0) gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) it returns: File "face_detection.py", line 11,…
arthurckl
  • 5,281
  • 6
  • 17
  • 16
95
votes
6 answers

imshow doesn't need convert from BGR to RGB

As I'm lead to believe, OpenCV reads images in BGR colorspace ordering and we usually have to convert it back to RGB like this: img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) But when I try to simply read an image and show it, the coloring seems fine…
Cypher
  • 2,374
  • 4
  • 24
  • 36
95
votes
2 answers

Augmented Reality SDK with OpenCV

I am developing an Augmented Reality SDK on OpenCV. I had some problems to find tutorials on the topic, which steps to follow, possible algorithms, fast and efficient coding for real-time performance etc. So far I have gathered the next information…
Jav_Rock
  • 22,059
  • 20
  • 123
  • 164
93
votes
5 answers

Does performance differ between Python or C++ coding of OpenCV?

I aim to start opencv little by little but first I need to decide which API of OpenCV is more useful. I predict that Python implementation is shorter but running time will be more dense and slow compared to the native C++ implementations. Is there…
erogol
  • 13,156
  • 33
  • 101
  • 155
91
votes
12 answers

Python: How to pip install opencv2 with specific version 2.4.9?

I know that I could pip install opencv-python which installs opencv3, but is there a separate command or name for opencv specific version such as 2.4.9? If not, how can I specify which version to install? Thanks.
matchifang
  • 5,190
  • 12
  • 47
  • 76
91
votes
2 answers

What are keypoints in image processing?

When using OpenCV for example, algorithms like SIFT or SURF are often used to detect keypoints. My question is what actually are these keypoints? I understand that they are some kind of "points of interest" in an image. I also know that they are…
dephinera
  • 3,703
  • 11
  • 41
  • 75