Transition from OpenCV 2 to OpenCV 3.x Read Courses Practice Improve Improve Improve Like Article Like Save Article Save Report issue Report 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. Feature Detection 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. # OpenCV 2.4 sift = cv2.SIFT() # OpenCV 3.4.1 sift = cv2.xfeatures2d.SIFT_create() SURF : Create SURF feature detector object # OpenCV 2.4 surf = cv2.SURF() # OpenCV 3.4.1 surf = cv2.xfeatures2d.SURF_create() FAST : Create FAST detector object # OpenCV 2.4 fast = cv2.FastFeatureDetector() # OpenCV 3.4.1 fast = cv2.FastFeatureDetector_create() ORB : Create ORB detector object # OpenCV 2.4 orb = cv2.ORB() # OpenCV 3.4.1 orb = cv2.ORB_create() Simple Blob Detector # OpenCV 2.4 detector = cv2.SimpleBlobDetector() # OpenCV 3.4.1 detector = cv2.SimpleBlobDetector_create() CIRCLE DETECTION OpenCV uses Hough Gradient Method to detect circles that uses gradient information of the edges. # OpenCV 3.4.1 circles = cv2.HoughCircles(img, cv2.HOUGH_GRADIENT, 4, 10) The name of the method has been changed from CV_HOUGH_GRADIENT in 2.4 version to HOUGH_GRADIENT in 3.4 version. CONTOURS Initially the 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. # OpenCV 2.4 contours, hierarchy = cv2.findContours(img, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE) # OpenCV 3.4.1 im, contours, hierarchy = cv2.findContours(img, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE) These were a few important changes that could be useful while migrating the code from OpenCV 2 .4 to OpenCV 3.x . Don't miss your chance to ride the wave of the data revolution! Every industry is scaling new heights by tapping into the power of data. Sharpen your skills, become a part of the hottest trend in the 21st century.Dive into the future of technology - explore the Complete Machine Learning and Data Science Program by GeeksforGeeks and stay ahead of the curve. Commit to GfG's Three-90 Challenge! Purchase a course, complete 90% in 90 days, and save 90% cost click here to explore. Last Updated : 03 Jan, 2023 Like Article Save Article Previous Python OpenCV - Dense optical flow Next How to display most frequent value in a Pandas series? Share your thoughts in the comments Add Your Comment Please Login to comment... Similar Reads OpenCV - Facial Landmarks and Face Detection using dlib and OpenCV OpenCV C++ Program to play a video OpenCV C++ Program to blur a Video OpenCV C++ Program to create a single colored blank image OpenCV Python Program to blur an image OpenCV C++ Program for coin detection Vehicle detection using OpenCV Python Opencv Python program for Face Detection Real-Time Edge Detection using OpenCV in Python | Canny edge detection method Set up Opencv with anaconda environment Complete Tutorials Python API Tutorial: Getting Started with APIs Advanced Python Tutorials Python Automation Tutorial OpenAI Python API - Complete Guide Pandas AI: The Generative AI Python Library Like akankshaakkihal27 Follow Article Tags : OpenCV Python-OpenCV Python Practice Tags : python Additional Information Current difficulty : Basic Vote for difficulty : Easy Normal Medium Hard Expert