neuro-lab6/cap.py

16 lines
326 B
Python
Raw Normal View History

2025-11-29 13:57:50 +02:00
import cv2 as cv
import time
import tensorflow
from tensorflow.keras.utils import array_to_img as img
c = cv.VideoCapture(0)
for i in range(200):
print(f"pic {i}")
err, frame = c.read()
img(cv.cvtColor(frame, cv.COLOR_BGR2RGB)).resize((300, 300)).save(f"../cap-2/no/{i:02d}.jpg")
time.sleep(0.5)
c.close()