Uploaded December 2019 | Updated September 2026, 2 weeks ago
Here I quickly demonstrating how I use CV2 Python module for detecting rectangles that frames data of nutritious, vitamins, other components and ingredients on food packages.
For this I used Canny Algorithm for detecting edges in original image. After this CV2 detect rectangles, draw it on a given image and deliver its coordinates. Then apply CV2 Blur filter on inside boundaries of rectangles.
I think that it is a good approach for image pre-processing for labeling images for your object detection model, such as YOLO, Faster R-CNN or other one project in the field of deep learning for computer vision.
Vytautas.
#detectrectangles
#opencvblur
#opencvfindobjects
Here I quickly demonstrating how I use CV2 Python module for detecting rectangles that frames data of nutritious, vitamins, other components and ingredients on food packages.
For this I used Canny Algorithm for detecting edges in original image. After this CV2 detect rectangles, draw it on a given image and deliver its coordinates. Then apply CV2 Blur filter on inside boundaries of rectangles.
I think that it is a good approach for image pre-processing for labeling images for your object detection model, such as YOLO, Faster R-CNN or other one project in the field of deep learning for computer vision.
Vytautas.
#detectrectangles
#opencvblur
#opencvfindobjects









![Stop using range() for loops in Python. Use enumerate()
With this video I explain why in many cases we should use enumerate() instead of range() function in Python for loops.
The way of using range() is ugly: You either need a separate variable assignment to get the element or use a[i] all the time which could theoretically be an expensive operation. The point is that you generally dont want to use range(len(l)) when you want to iterate the elements of a list (although there may still be cases where it makes sense).
I think than enumerate is much more flexible and readable Python coding option than len(l) with range().
Thank you for watching. See you on other tutorials.
Vytautas.
#pythonfunctions
#pythonloops
#pythonbegineers Stop using range() for loops in Python. Use enumerate()](https://i.ytimg.com/vi/XUtAy9K0JSE/mqdefault.jpg)
