📅 2015-Jan-20 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ constant, opencv, python ⬩ 📚 Archive
OpenCV has a Python API. The Python function calls are well documented and listed along with the C and C++ calls. However, it is not obvious how to use the various OpenCV constants and enums in Python. These are typically named as CV_SOME_THING
. For example: CV_WINDOW_AUTOSIZE
.
cv
package. For example:import cv
win = cv.NamedWindow("haha", cv.CV_WINDOW_AUTOSIZE)
Here is a list of integer values for OpenCV constants that I frequently need to use:
CV_LOAD_IMAGE_UNCHANGED = -1
CV_LOAD_IMAGE_GRAYSCALE = 0
CV_LOAD_IMAGE_COLOR = 1
CV_LOAD_IMAGE_ANYDEPTH = 2
CV_LOAD_IMAGE_ANYCOLOR = 4
Tried with: OpenCV 2.4.9, Python 2.7.3 and Ubuntu 14.04