Basic example of creating an image doesn't work

I can’t get my App to draw an image.
The code I found here:
#OpenCV: Drawing Functions in OpenCV

import numpy as np
import cv2 as cv
img = np.zeros((512,512,3), np.uint8)
cv.line(img,(0,0),(511,511),(255,0,0),5)

I guess this code should draw an image but it does nothing.

it correctly draws a line into an existing image.

if you expected to see a window showing your image
– your code does not do that.

You must have skipped the preceding two tutorials.

OpenCV is a library for people who are experienced programmers.

Please seek out a forum for beginners. We don’t have the capacity to help people learn how to program.

Perhaps you would like to learn about “PyGame”.

1 Like