committed by
Alexander Alekhin
parent
5e2bcc9149
commit
f9c514b391
+1
-1
@@ -144,7 +144,7 @@ cv.rectangle(img,(x,y),(x+w,y+h),(0,255,0),2)
|
||||
### 7.b. Rotated Rectangle
|
||||
|
||||
Here, bounding rectangle is drawn with minimum area, so it considers the rotation also. The function
|
||||
used is **cv.minAreaRect()**. It returns a Box2D structure which contains following detals - (
|
||||
used is **cv.minAreaRect()**. It returns a Box2D structure which contains following details - (
|
||||
center (x,y), (width, height), angle of rotation ). But to draw this rectangle, we need 4 corners of
|
||||
the rectangle. It is obtained by the function **cv.boxPoints()**
|
||||
@code{.py}
|
||||
|
||||
+1
-1
@@ -185,7 +185,7 @@ array([[[ 3, -1, 1, -1],
|
||||
And this is the final guy, Mr.Perfect. It retrieves all the contours and creates a full family
|
||||
hierarchy list. **It even tells, who is the grandpa, father, son, grandson and even beyond... :)**.
|
||||
|
||||
For examle, I took above image, rewrite the code for cv.RETR_TREE, reorder the contours as per the
|
||||
For example, I took above image, rewrite the code for cv.RETR_TREE, reorder the contours as per the
|
||||
result given by OpenCV and analyze it. Again, red letters give the contour number and green letters
|
||||
give the hierarchy order.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user