Код: Выделить всё
import cv2, psutil, os, gc, time
def takepic():
frame = None
cw, ch = 4000, 3000
cap = cv2.VideoCapture(0)
print('click!')
cap.set(cv2.CAP_PROP_FRAME_WIDTH, cw)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, ch)
time.sleep(0.6)
suc, frame = cap.read()
cap.release()
process = psutil.Process(os.getpid())
print(f'Memory Used {round(process.memory_percent(), 2)}%')
resizeit(frame)
def resizeit(img):
small = cv2.resize(img, (0,0), fx=0.5, fy=0.5)
del small
del img
print(gc.get_count())
gc.collect()
print(gc.get_count())
time.sleep(1)
takepic()
takepic()
[img]https://i. sstatic.net/KIWkbuGy.png[/img]
Подробнее здесь: https://stackoverflow.com/questions/793 ... amera-loop
Мобильная версия