Transition from OpenCV 2 to OpenCV 3.x
OpenCV is one of the most popular and most used Computer vision libraries. It contains tools to carry out image and video processing.
When OpenCV 3..4.1 is an improved version of OpenCV 2.4 as it introduced new algorithms and features. Although some of the existing modules were rewritten and moved to sub-modules. In this articles, I will focus on the changes made in the existing modules of OpenCV 2.4 and how they can be implemented in OpenCV 3.4.1.
Some of the feature detection algorithms (FREAK, BRIEF, SIFT and SURF) have been moved to opencv_contrib repository and xfeatures2d module. SIFT and SURF algorithms are patented by their creators and are non-free. Although they can be used for educational and research purposes.
SIFT : Create SIFT feature detector object.
SURF : Create SURF feature detector object
FAST : Create FAST detector object
ORB : Create ORB detector object
Simple Blob Detector
OpenCV uses Hough Gradient Method to detect circles that uses gradient information of the edges.
The name of the method has been changed from
CV_HOUGH_GRADIENT in 2.4 version to
HOUGH_GRADIENT in 3.4 version.
findContours() function returned only two parameters in OpenCV 2.4 . In OpenCV 3.2 onwards, the function was modified to return three parameters i.e. the modified image, contours and hierarchy.
cv2.findContours(img, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE)
im, contours, hierarchy
These were a few important changes that could be useful while migrating the code from OpenCV 2 .4 to OpenCV 3.x .