Getting an “integer is required (got type tuple)” error, drawing a rectangle using cv2

前端 未结 3 1694
日久生厌
日久生厌 2021-01-15 01:19

I have written a basic Python code to create an image and then putting a rectangle on the boundaries. This doesn\'t seem to work. I have checked multiple sites and this is t

3条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-15 01:35

    In some cases OpenCV will need wrapping image with UMat class.

    img = Image.new('RGB', (800, 900), color= (171, 183, 255))
    open_cv_image = np.array(img) 
    image = cv2.UMat(open_cv_image).get()
    cv2.rectangle(open_cv_image,(0,0),(800,900),(0,0,0),30)
    

提交回复
热议问题