Skip to content

update #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 49 additions & 3 deletions PyFry.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,54 @@
from utils.utils import Colors
from imutils import face_utils
import dlib
import sys

'''
TODO: -> Compressing (Crushing) and back (to increase noise) :: DONE
-> Applying Red and Orange hue filters for classic deep fry look
-> Detecting eye coordinates and applying the deepfry eye flare in the center
'''


#using camera to read
cam = cv2.VideoCapture(0)

cv2.namedWindow("Smile")

img_counter = 0

while True:
ret, frame = cam.read()
cv2.imshow("Smile", frame)
if not ret:
break
k = cv2.waitKey(1)

if k%256 == 27:
# ESC pressed
print("Escape hit, closing...")
break
elif k%256 == 32:
# SPACE pressed
img_name = "opencv_frame_{}.jpg".format(img_counter)
cv2.imwrite(img_name, frame)
print("{} written!".format(img_name))
#img_counter += 1
cv2.destroyAllWindows()
image = cv2.imread(img_name)
cv2.imshow("Original", image)


break

cam.release()
cv2.waitKey(0)
cv2.destroyAllWindows()





def irisCoords(eye):
#Finding the center point of th eye using the average outer extremes average of the eyes
mid = (eye[0] +eye[3])/2
Expand Down Expand Up @@ -40,13 +83,16 @@ def main():
# Initialising dlib for frontal facial features
flare = Image.open('flare.png')
detect = dlib.get_frontal_face_detector()
predict = dlib.shape_predictor("assets\shape_predictor_68_face_landmarks.dat")
predict = dlib.shape_predictor("/Users/shahil/Documents/GitHub/PyFry/assets/shape_predictor_68_face_landmarks.dat")

(lS, lE) = face_utils.FACIAL_LANDMARKS_68_IDXS["left_eye"]
(rS, rE) = face_utils.FACIAL_LANDMARKS_68_IDXS["right_eye"]

imgCV = cv2.imread('test.jpg')
img = Image.open('test.jpg')

#use camera to read
imgCV = cv2.imread('opencv_frame_0.jpg')
img = Image.open('opencv_frame_0.jpg')


gray = cv2.cvtColor(imgCV, cv2.COLOR_BGR2GRAY)
subjects = detect(gray, 0)
Expand Down
Binary file added opencv_frame_0.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified output.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added utils/__pycache__/utils.cpython-37.pyc
Binary file not shown.