I can not find the CV_XXXXX key in the cv2 module:
- Try
cv2.XXXXX - Otherwise use
cv2.cv.CV_XXXXX
In your case, cv2.cv.CV_IMWRITE_PNG_COMPRESSION .
Additional Information.
Documents for OpenCV (cv2 interface) are a bit confusing.
Usually parameters that look like CV_XXXX are actually cv2.XXXX .
I use the following to find the relevant cv2 constant cv2 . Say I was looking for CV_MORPH_DILATE . I will look for any constant with MORPH in it:
import cv2 nms = dir(cv2)
From this, I see that MORPH_DILATE is what I am looking for.
However , sometimes constants do not move from the cv interface to the cv2 interface.
In this case, they can be found in the cv2.cv.CV_XXXX section.
So, I was looking for IMWRITE_PNG_COMPRESSION for you and could not find it (under cv2.... ), and so I looked under cv2.cv.CV_IMWRITE_PNG_COMPRESSION , and hey presto! It is there:
>>> cv2.cv.CV_IMWRITE_PNG_COMPRESSION 16
mathematical.coffee
source share