import cv2

# read webcam
webcam = cv2.VideoCapture(0)

# visualize webcam

while True:
    ret, frame = webcam.read()

    # Three vertices(tuples) of the triangle  
    p1 = (0, 20) 
    p2 = (640, 20) 
    p3 = (320, 480) 
    
    # Drawing the triangle with the help of lines 
    #  on the black window With given points  
    # cv2.line is the inbuilt function in opencv library 
    cv2.line(frame, p1, p2, (255, 0, 0), 3) 
    cv2.line(frame, p2, p3, (255, 0, 0), 3) 
    cv2.line(frame, p1, p3, (255, 0, 0), 3) 

    cv2.putText(frame, 'Hello World', (240, 240), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 0), 4)
    
    cv2.imshow('frame', frame)
    if cv2.waitKey(40) & 0xFF == ord('q'):
        break



webcam.release()
cv2.destroyAllWindows()