I need to auto capture the selfie image when smile or movement detected through camera in flutter. How can I achieve this, is there any tool or libraries?
CodePudding user response:
You need to use OpenCv
opencv: ^1.0.4
Steps to Develop the Project
Steps Involved to implement Smile Detection and Selfie Capture Project
We first import the openCV library.
Now start webcam in the second line using the VideoCapture function of cv2.
Then, include haarcascade files in the python file.
Then we are reading images from the video through read().
As feature recognition is more accurate in grey images we will convert the image to a grey image using cvtColor() and BGR2GRAY which are basic openCV functions.
Now we will read faces using an already included haarcascade file and detectMultiscale() function where we pass grey image, ScaleFactor, and minNeighbors.
If it detects a face we will draw an outer boundary of the face using rectangle() method of cv2 containing 5 arguments: image, initial point (x, y), an endpoint of principal diagonal (x width, y height), color of the rectangular periphery and last parameter is the thickness of drawn rectangular periphery.
If the face is detected then we will similarly detect a smile and if a smile is detected too we will print Image saved in the cmd/terminal and then we have to provide the location of the folder in which we want to save the images.
To save the images we will use imwrite() which takes 2 parameters- location and image.
CodePudding user response:
Firebase ML do it and more
firebase_ml_custom: ^0.2.0 3