Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
bbefc101
Commit
bbefc101
authored
Feb 12, 2014
by
Martin Dlouhy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed return images and fixed cv2 names
parent
511e79ae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
py_contour_features.rst
...c/py_contours/py_contour_features/py_contour_features.rst
+7
-7
No files found.
doc/py_tutorials/py_imgproc/py_contours/py_contour_features/py_contour_features.rst
View file @
bbefc101
...
...
@@ -119,7 +119,7 @@ Let (x,y) be the top-left coordinate of the rectangle and (w,h) be its width and
::
x,y,w,h = cv2.boundingRect(cnt)
img =
cv2.rectangle(img,(x,y),(x+w,y+h),(0,255,0),2)
cv2.rectangle(img,(x,y),(x+w,y+h),(0,255,0),2)
7.b. Rotated Rectangle
-----------------------
...
...
@@ -127,9 +127,9 @@ Here, bounding rectangle is drawn with minimum area, so it considers the rotatio
::
rect = cv2.minAreaRect(cnt)
box = cv2.
b
oxPoints(rect)
box = cv2.
cv.B
oxPoints(rect)
box = np.int0(box)
im = cv2.drawContours(im
,[box],0,(0,0,255),2)
cv2.drawContours(img
,[box],0,(0,0,255),2)
Both the rectangles are shown in a single image. Green rectangle shows the normal bounding rect. Red rectangle is the rotated rect.
...
...
@@ -145,7 +145,7 @@ Next we find the circumcircle of an object using the function **cv2.minEnclosing
(x,y),radius = cv2.minEnclosingCircle(cnt)
center = (int(x),int(y))
radius = int(radius)
img =
cv2.circle(img,center,radius,(0,255,0),2)
cv2.circle(img,center,radius,(0,255,0),2)
.. image:: images/circumcircle.png
:alt: Minimum Enclosing Circle
...
...
@@ -158,7 +158,7 @@ Next one is to fit an ellipse to an object. It returns the rotated rectangle in
::
ellipse = cv2.fitEllipse(cnt)
im = cv2.ellipse(im
,ellipse,(0,255,0),2)
cv2.ellipse(img
,ellipse,(0,255,0),2)
.. image:: images/fitellipse.png
:alt: Fitting an Ellipse
...
...
@@ -172,10 +172,10 @@ Similarly we can fit a line to a set of points. Below image contains a set of wh
::
rows,cols = img.shape[:2]
[vx,vy,x,y] = cv2.fitLine(cnt, cv2.DIST_L2,0,0.01,0.01)
[vx,vy,x,y] = cv2.fitLine(cnt, cv2.
cv.CV_
DIST_L2,0,0.01,0.01)
lefty = int((-x*vy/vx) + y)
righty = int(((cols-x)*vy/vx)+y)
img =
cv2.line(img,(cols-1,righty),(0,lefty),(0,255,0),2)
cv2.line(img,(cols-1,righty),(0,lefty),(0,255,0),2)
.. image:: images/fitline.jpg
:alt: Fitting a Line
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment