ich habe Code aus einem Tutorial nachgetippt. Es funktioniert auch so wie gedacht aber meine IDE, PyCharm gibt eine dicke rote Warnung aus. Diese würde ich gerne verstehen und beheben.
Code: Alles auswählen
# import opencv and numpy
import cv2
import numpy as np
def nothing(x):
pass
cv2.namedWindow('controls')
cv2.createTrackbar('r', 'controls', 15, 255, nothing)
while True:
img = np.zeros((512, 512, 3), np.uint8)
img_center_y = img.shape[0] // 2
img_center_x = img.shape[1] // 2
radius = int(cv2.getTrackbarPos('r', 'controls'))
cv2.circle(img, (img_center_y, img_center_x), radius, (0, 0, 255), -1)
cv2.imshow('img', img)
k = cv2.waitKey(1) & 0xFF
if k == 27:
break
cv2.destroyAllWindows()
[ WARN:0] global C:\Users\runneradmin\AppData\Local\Temp\pip-req-build-sn_xpupm\opencv\modules\highgui\src\window.cpp (704) cv::createTrackbar UI/Trackbar(r@controls): Using 'value' pointer is unsafe and deprecated. Use NULL as value pointer. To fetch trackbar value setup callback.