How to Draw Line on Image and Video in OpenCV
Machine Learning courses with 100+ Real-time projects Start Now!!
Program 1
import cv2
import numpy
img1=cv2.imread("D://opencvapp/library-img.jpg")
# print(type(img1))
# print(img1)
h=img1.shape[0]
w=img1.shape[1]
#print("height",h)
#print("width",w)
img1=cv2.line(img1,(0,0),(w,h),(0,0,255),10)
img1=cv2.line(img1,(w,0),(0,h),(0,0,255),10)
cv2.imshow('Library Image',img1)
cv2.waitKey(0)
cv2.destroyAllWindows()
If you are Happy with DataFlair, do not forget to make us happy with your positive feedback on Google

