UPDATE: Enable Web Stream Using M5StickC(ESP32 device) and Use UnitV as an alternative.....
Using the M5stickV and its preinstalled Face detection model that can also detect faces with mask......
I used the Face model preinstalled on M5stickV and the sample code along with to thinker..."demo_find_face.py_"
Sample random image I used for good quality::
The average head dimension I used is 25.cm or 0.25m
https://commons.wikimedia.org/wiki/File:Camper_Measurements_on_human_male_head.jpg
Using the dimension of the face detected we can try to estimate the number of face between 2 persons....Somewhat 3 by estimate........You can adjust this in this variable "Viola" in this code I used 4..... as testing..
Assuming 1 meter Social Distancing
Viola =4 #average face distance in between
To measure the distance between two face..Used the pixel coordinates given in this command::(other useful data to be used later)
Xcor.insert(i.index(),i.x()+(i.w()/2))
Ycor.insert(i.index(),i.y()+(i.h()/2))
Wd.insert(i.index(),i.w())
Lh.insert(i.index(),i.h())
Converting the 2 face distances in pixel to number of faces, by using the smallest diagonal face pixel....
Dist = math.sqrt(((Xcor[c] - Xcor[c+1])**2) + (Ycor[c] - Ycor[c+1])**2)
uno =math.sqrt(((Wd[c] )**2) + ((Lh[c])**2))# 1st face
print("Uno",uno)ma
dos =math.sqrt(((Wd[c+1] )**2) + ((Lh[c+1])**2))# 2nd face
print("Dos",dos)
AvgFace = uno
if uno >=dos:
AvgFace = dos
print("Average Face Diagonal",AvgFace)
print("Distance",Dist)
Viola =4 #average face distance in between
if ( Viola >= Dist/AvgFace ):
print("ViolatoR", c , c+1)
img.draw_string(int(Xcor[c]), int(Ycor[c]-(Lh[c]*0.25)), "X", scale=3)
img.draw_string(int(Xcor[c+1]), int(Ycor[c+1]-(Lh[c+1]*0.25)), "X", scale=3)
Test picture:::
Test Video Clip::
REMARK::
* Due to limitation of the model and the camera this is not as accurate....
*Test and an attempt.....
*Assuming of 3-3.5 faces as 1 meter (adjustable)
*Video was capture directly from M5stickV and save via MaixpyIDE
*Proof of Concept.....
UPDATE:::
Connect M5stickC and UnitV/M5StickV using grove connecting cable....
Work with Firefox browser......
Chrome both android and PC unsuccessful...
Added Web Streaming Feature based from https://homemadegarbage.com/ai13
Connect to the Access Point...and add "/mstream" after the ip address of M5stickC..example:: 192.168.1.107/mstream
To get the IP Address used the Arduino Terminal, it will gave an IP Address...
Comments