Python Save Auto Images or Photos CV2 Python - learnit

Home Top Ad

Post Top Ad

Sunday, February 6, 2022

Python Save Auto Images or Photos CV2 Python

C Programming How to Use switch Statement

OpenCV Python Tutorial

OpenCV is a massive open-source computer vision, machine learning, and image processing library. OpenCV is compatible with a wide range of programming languages, including Python, C++, and Java. It can analyze images and videos to recognize objects, faces, and even human handwriting. When it is combined with other libraries, such as Numpy, a highly optimized library for numerical operations, the number of weapons in your arsenal grows, as any operation that can be done in Numpy can be combined with OpenCV.


This OpenCV tutorial will teach you the fundamentals of image processing, such as operations on images and videos, through the use of a large set of OpenCV programs and projects.


Python time Module


In this article, we will look in depth at the time module. With the help of examples, we will learn how to use the various time-related functions defined in the time module.


To handle time-related tasks, Python has a module called time. To use the module's functions, we must first import the module


import import


Example Python Save Auto Images or Photo CV2 Pythpn

import cv2
import time
cam = cv2.VideoCapture(0)
facecasecade = cv2.CascadeClassifier('haarcascade_frontalface.xml')
cap = cv2.VideoCapture(0)
count = 0
while True:
    _, img = cap.read()
    grap = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
    faces = facecasecade.detectMultiScale(grap, 1.1, 4)
    for(x,y,w,h) in faces:
        cv2.rectangle(img, (x, y), (x+w, y+h), (255, 0, 0), 2)
        cv2.imshow("reanits", img)
        t = time.strftime("%y-%m-%d_%H-%M-%S")
        print("image"+t+"Save")
        file= 'D:/photo/' +t+ '.jpg'
        cv2.imwrite(file, img)
        count += 1
    k = cv2.waitKey(30) & 0xff
   if k==27:
        break
cap.release()

Please Watching My Video is Below


No comments:

Post a Comment

Post Top Ad