First we will see how to draw some shape or how to write text on image from OPEN CV. As you know first we import libraries for doing stuffs related to it so I am not going to tell it in every part but when to import new libraries i will explain you.

Here is code —

Image for post

cat.png(MY IMAGE)

image=cv2.imread('cat.png',cv2.IMREAD_COLOR)

cv2.line(image,(50,50),(350,50),(255,255,255),5,cv2.LINE_AA)

cv2.rectangle(image,(250,250),(400,400),(0,250,125),5)

cv2.circle(image,(200,203),100,(0,0,255),1)

points=np.array([[4,5],[100,150],[230,67],[203,190]],np.int32)
cv2.polylines(image,[points],True,(255,255,0),1)

font=cv2.FONT_HERSHEY_COMPLEX_SMALL
cv2.putText(image,'opencv part2',(0,130),font,1,(200,234,123),2,cv2.LINE_8)

cv2.imshow('image',image)

cv2.waitKey(0)
cv2.destroyAllWindows()

I will explain you upper code line by line — -

#data-science #numpy #data-visualization #opencv #machine-learning

Interacting with webcam and video file and some drawing with OPEN CV
1.25 GEEK