'cv2 line change from horizontal to vertical [closed]
I am trying to figure out how to change a line drawn in cv2 in some code from horizontal to vertical. It comes out horizontal with this:
cv2.line(frame, (0, H // 2), (W, H // 2), (0, 255, 255), 2)
How to change to vertical?
I understand the line starts with parameter (0, H // 2) and ends with (W, H // 2) but its puzzling to me how to change it around from horizontal coordinate definition to vertical. Some experimentations with this have been unsuccessful and tips GREATLY appreciated.
H & W are defined to have a maximum of 500 pixels defined here:
# loop over frames from the video stream
while True:
# grab the next frame and handle if we are reading from either
# VideoCapture or VideoStream
frame = vs.read()
frame = frame[1] if args.get("input", False) else frame
# if we are viewing a video and we did not grab a frame then we
# have reached the end of the video
if args["input"] is not None and frame is None:
break
# resize the frame to have a maximum width of 500 pixels (the
# less data we have, the faster we can process it), then convert
# the frame from BGR to RGB for dlib
frame = imutils.resize(frame, width=500)
rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
# if the frame dimensions are empty, set them
if W is None or H is None:
(H, W) = frame.shape[:2]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
