Hello everyone I have a problem regarding python and openCV. I want to make a rectangle in the middle of a video stream I was able to do it with a static image using the PIL library
CODE:
from PIL import Image, ImageDraw im = Image.open("test1.jpg") draw = ImageDraw.Draw(im) draw1 = ImageDraw.Draw(im) draw2 = ImageDraw.Draw(im) draw3 = ImageDraw.Draw(im) draw.line((192,1, 192,480), fill=255) draw1.line((395,1, 395,480), fill=255) draw2.line((1,50, 640,50), fill=255) draw3.line((1,305, 640,305), fill=255)im.show()
########################################################################################
I don’t understand how to do it with the opencv library I have been trying for weeks and the
python opencv documentation is not that helpful or detailed I found this
adapting the way he did it I made a program
from PIL import Image, ImageDraw
import cv2
import numpy
im = Image.open(“test1.jpg”)
im = cv2.line(im,(0,0),(511,511),(255,0,0),5)
im.show()
but I get an error
saying “TypeError: img is not a numpy array, neither a scalar”.
So do you guys have any suggestions or information.
Thank you