added crop option
This commit is contained in:
parent
e14ecd308f
commit
f0876c31be
BIN
cropScared.jpg
Normal file
BIN
cropScared.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
8
main.py
8
main.py
@ -46,8 +46,14 @@ if cam.isOpened():
|
|||||||
predictions = DeepFace.analyze(img,actions=['emotion'])
|
predictions = DeepFace.analyze(img,actions=['emotion'])
|
||||||
fearPoint = predictions[0]["emotion"]["fear"]
|
fearPoint = predictions[0]["emotion"]["fear"]
|
||||||
print("FEAR:" + str(fearPoint))
|
print("FEAR:" + str(fearPoint))
|
||||||
if fearPoint>20:
|
if fearPoint>10:
|
||||||
cv2.imwrite('scared.jpg', img)
|
cv2.imwrite('scared.jpg', img)
|
||||||
|
basewidth = 384
|
||||||
|
imgCrop = Image.open('scared.jpg')
|
||||||
|
wpercent = (basewidth/float(imgCrop.size[0]))
|
||||||
|
hsize = int((float(imgCrop.size[1])*float(wpercent)))
|
||||||
|
imgCrop = imgCrop.resize((basewidth,hsize), Image.ANTIALIAS)
|
||||||
|
imgCrop = imgCrop.save("cropScared.jpg")
|
||||||
img = cv2.cvtColor(img,cv2.COLOR_BGR2RGB)
|
img = cv2.cvtColor(img,cv2.COLOR_BGR2RGB)
|
||||||
img = Image.fromarray(img)
|
img = Image.fromarray(img)
|
||||||
draw = ImageDraw.Draw(img)
|
draw = ImageDraw.Draw(img)
|
||||||
|
BIN
scared.jpg
BIN
scared.jpg
Binary file not shown.
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 106 KiB |
Loading…
Reference in New Issue
Block a user