diff --git a/README.md b/README.md index 5d3f251..df96c5a 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,6 @@ For more information, along with a detailed code review check out the following - [http://www.pyimagesearch.com/2015/08/10/checking-your-opencv-version-using-python/](http://www.pyimagesearch.com/2015/08/10/checking-your-opencv-version-using-python/) ## Installation -Provided you already have NumPy, SciPy, Matplotlib, and OpenCV already installed, the `imutils` package is completely `pip`-installable: -
$ pip install imutils## Finding function OpenCV functions by name @@ -127,17 +125,19 @@ cv2.waitKey(0)
## Checking OpenCV Versions
-OpenCV 3 has finally been released! But with the major release becomes backward compatibility issues (such as with the `cv2.findContours` and `cv2.normalize` functions). If you want your OpenCV 3 code to be backwards compatible with OpenCV 2.4.X, you'll need to take special care to check which version of OpenCV is currently being used and then take appropriate action. The `is_cv2()` and `is_cv3()` are simple functions that can be used to automatically determine the OpenCV version of the current environment.
+OpenCV 3 has finally been released! But with the major release becomes backward compatibility issues (such as with the `cv2.findContours` and `cv2.normalize` functions). If you want your OpenCV 3 code to be backwards compatible with OpenCV 2.4.X, you'll need to take special care to check which version of OpenCV is currently being used and then take appropriate action. The `is_cv2()`, `is_cv3()` and `is_cv4()` are simple functions that can be used to automatically determine the OpenCV version of the current environment.
#### Example:
print("Your OpenCV version: {}".format(cv2.__version__))
print("Are you using OpenCV 2.X? {}".format(imutils.is_cv2()))
-print("Are you using OpenCV 3.X? {}".format(imutils.is_cv3()))
+print("Are you using OpenCV 3.X? {}".format(imutils.is_cv3()))
+print("Are you using OpenCV 4.X? {}".format(imutils.is_cv4()))
#### Output:
Your OpenCV version: 3.0.0 Are you using OpenCV 2.X? False -Are you using OpenCV 3.X? True+Are you using OpenCV 3.X? True +Are you using OpenCV 4.X? False ## Automatic Canny Edge Detection The Canny edge detector requires two parameters when performing hysteresis. However, tuning these two parameters to obtain an optimal edge map is non-trivial, especially when working with a dataset of images. Instead, we can use the `auto_canny` function which uses the median of the grayscale pixel intensities to derive the upper and lower thresholds. You can read more about the `auto_canny` function [here](http://www.pyimagesearch.com/2015/04/06/zero-parameter-automatic-canny-edge-detection-with-python-and-opencv/). diff --git a/setup.py b/setup.py index 9c5b381..c53506d 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,10 @@ -from distutils.core import setup +from setuptools import setup +import sys + +if sys.version_info.major == 2: + open_cv = 'opencv-python==4.2.0.32' # Last supported version for Python 2.7 +else: + open_cv = 'opencv-python' # Latest available version setup( name='imutils', @@ -12,4 +18,10 @@ keywords=['computer vision', 'image processing', 'opencv', 'matplotlib'], classifiers=[], scripts=['bin/range-detector'], + install_requires=[ + 'numpy', + 'scipy', + 'matplotlib', + open_cv + ] )