remove bounding box dots and extraneous code
This commit is contained in:
parent
c523faafe9
commit
dc1ec9cddf
37
main.py
37
main.py
@ -1,5 +1,4 @@
|
|||||||
# import the necessary packages
|
# import the necessary packages
|
||||||
#from scipy.spatial import distance as dist
|
|
||||||
from imutils import perspective
|
from imutils import perspective
|
||||||
from imutils import contours
|
from imutils import contours
|
||||||
import numpy as np
|
import numpy as np
|
||||||
@ -97,8 +96,8 @@ for c in cnts:
|
|||||||
cv2.drawContours(orig, [box.astype("int")], -1, (0, 255, 0), 2)
|
cv2.drawContours(orig, [box.astype("int")], -1, (0, 255, 0), 2)
|
||||||
|
|
||||||
# loop over the original points and draw them
|
# loop over the original points and draw them
|
||||||
for (x, y) in box:
|
#for (x, y) in box:
|
||||||
cv2.circle(orig, (int(x), int(y)), 5, (0, 0, 255), -1)
|
#cv2.circle(orig, (int(x), int(y)), 5, (0, 0, 255), -1)
|
||||||
|
|
||||||
# unpack the ordered bounding box, then compute the midpoint
|
# unpack the ordered bounding box, then compute the midpoint
|
||||||
# between the top-left and top-right coordinates, followed by
|
# between the top-left and top-right coordinates, followed by
|
||||||
@ -113,34 +112,10 @@ for c in cnts:
|
|||||||
(trbrX, trbrY) = midpoint(tr, br)
|
(trbrX, trbrY) = midpoint(tr, br)
|
||||||
|
|
||||||
# draw the midpoints on the image
|
# draw the midpoints on the image
|
||||||
cv2.circle(orig, (int(tltrX), int(tltrY)), 5, (255, 0, 0), -1)
|
#cv2.circle(orig, (int(tltrX), int(tltrY)), 5, (255, 0, 0), -1)
|
||||||
cv2.circle(orig, (int(blbrX), int(blbrY)), 5, (255, 0, 0), -1)
|
#cv2.circle(orig, (int(blbrX), int(blbrY)), 5, (255, 0, 0), -1)
|
||||||
cv2.circle(orig, (int(tlblX), int(tlblY)), 5, (255, 0, 0), -1)
|
#cv2.circle(orig, (int(tlblX), int(tlblY)), 5, (255, 0, 0), -1)
|
||||||
cv2.circle(orig, (int(trbrX), int(trbrY)), 5, (255, 0, 0), -1)
|
#cv2.circle(orig, (int(trbrX), int(trbrY)), 5, (255, 0, 0), -1)
|
||||||
|
|
||||||
# draw lines between the midpoints
|
|
||||||
cv2.line(orig, (int(tltrX), int(tltrY)), (int(blbrX), int(blbrY)),
|
|
||||||
(255, 0, 255), 2)
|
|
||||||
cv2.line(orig, (int(tlblX), int(tlblY)), (int(trbrX), int(trbrY)),
|
|
||||||
(255, 0, 255), 2)
|
|
||||||
|
|
||||||
# unpack the ordered bounding box, then compute the midpoint
|
|
||||||
# between the top-left and top-right coordinates, followed by
|
|
||||||
# the midpoint between bottom-left and bottom-right coordinates
|
|
||||||
(tl, tr, br, bl) = box
|
|
||||||
(tltrX, tltrY) = midpoint(tl, tr)
|
|
||||||
(blbrX, blbrY) = midpoint(bl, br)
|
|
||||||
|
|
||||||
# compute the midpoint between the top-left and top-right points,
|
|
||||||
# followed by the midpoint between the top-righ and bottom-right
|
|
||||||
(tlblX, tlblY) = midpoint(tl, bl)
|
|
||||||
(trbrX, trbrY) = midpoint(tr, br)
|
|
||||||
|
|
||||||
# draw the midpoints on the image
|
|
||||||
cv2.circle(orig, (int(tltrX), int(tltrY)), 5, (255, 0, 0), -1)
|
|
||||||
cv2.circle(orig, (int(blbrX), int(blbrY)), 5, (255, 0, 0), -1)
|
|
||||||
cv2.circle(orig, (int(tlblX), int(tlblY)), 5, (255, 0, 0), -1)
|
|
||||||
cv2.circle(orig, (int(trbrX), int(trbrY)), 5, (255, 0, 0), -1)
|
|
||||||
|
|
||||||
# draw lines between the midpoints
|
# draw lines between the midpoints
|
||||||
cv2.line(orig, (int(tltrX), int(tltrY)), (int(blbrX), int(blbrY)),
|
cv2.line(orig, (int(tltrX), int(tltrY)), (int(blbrX), int(blbrY)),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user