Skip to content
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

use COLOR_BGR2RGB #1539

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
14 changes: 7 additions & 7 deletions examples/blink_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def main():
ret, frame = video_capture.read(0)
# cv2.VideoCapture.release()
small_frame = cv2.resize(frame, (0, 0), fx=0.25, fy=0.25)
rgb_small_frame = small_frame[:, :, ::-1]
rgb_small_frame = cv2.cvtColor(small_frame, cv2.COLOR_BGR2RGB)

face_landmarks_list = face_recognition.face_landmarks(rgb_small_frame)
process = True
Expand All @@ -35,12 +35,12 @@ def main():

# get it into the correct format
small_frame = cv2.resize(frame, (0, 0), fx=0.25, fy=0.25)
rgb_small_frame = small_frame[:, :, ::-1]
rgb_small_frame = cv2.cvtColor(small_frame, cv2.COLOR_BGR2RGB)



# get the correct face landmarks

if process:
face_landmarks_list = face_recognition.face_landmarks(rgb_small_frame)

Expand Down Expand Up @@ -73,7 +73,7 @@ def main():
while (asleep): #continue this loop until they wake up and acknowledge music
print("EYES CLOSED")

if cv2.waitKey(1) == 32: #Wait for space key
if cv2.waitKey(1) == 32: #Wait for space key
asleep = False
print("EYES OPENED")
closed_count = 0
Expand All @@ -89,14 +89,14 @@ def get_ear(eye):
# vertical eye landmarks (x, y)-coordinates
A = dist.euclidean(eye[1], eye[5])
B = dist.euclidean(eye[2], eye[4])

# compute the euclidean distance between the horizontal
# eye landmark (x, y)-coordinates
C = dist.euclidean(eye[0], eye[3])

# compute the eye aspect ratio
ear = (A + B) / (2.0 * C)

# return the eye aspect ratio
return ear

Expand Down
2 changes: 1 addition & 1 deletion examples/facerec_from_video_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
break

# Convert the image from BGR color (which OpenCV uses) to RGB color (which face_recognition uses)
rgb_frame = frame[:, :, ::-1]
rgb_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)

# Find all the faces and face encodings in the current frame of video
face_locations = face_recognition.face_locations(rgb_frame)
Expand Down
2 changes: 1 addition & 1 deletion examples/facerec_from_webcam.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
ret, frame = video_capture.read()

# Convert the image from BGR color (which OpenCV uses) to RGB color (which face_recognition uses)
rgb_frame = frame[:, :, ::-1]
rgb_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)

# Find all the faces and face enqcodings in the frame of video
face_locations = face_recognition.face_locations(rgb_frame)
Expand Down
4 changes: 2 additions & 2 deletions examples/facerec_from_webcam_faster.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
small_frame = cv2.resize(frame, (0, 0), fx=0.25, fy=0.25)

# Convert the image from BGR color (which OpenCV uses) to RGB color (which face_recognition uses)
rgb_small_frame = small_frame[:, :, ::-1]
rgb_small_frame = cv2.cvtColor(small_frame, cv2.COLOR_BGR2RGB)

# Find all the faces and face encodings in the current frame of video
face_locations = face_recognition.face_locations(rgb_small_frame)
face_encodings = face_recognition.face_encodings(rgb_small_frame, face_locations)
Expand Down
2 changes: 1 addition & 1 deletion examples/facerec_from_webcam_multiprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def process(worker_id, read_frame_list, write_frame_list, Global, worker_num):
Global.read_num = next_id(Global.read_num, worker_num)

# Convert the image from BGR color (which OpenCV uses) to RGB color (which face_recognition uses)
rgb_frame = frame_process[:, :, ::-1]
rgb_frame = cv2.cvtColor(frame_process, cv2.COLOR_BGR2RGB)

# Find all the faces and face encodings in the frame of video, cost most time
face_locations = face_recognition.face_locations(rgb_frame)
Expand Down
2 changes: 1 addition & 1 deletion examples/find_faces_in_batches.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
break

# Convert the image from BGR color (which OpenCV uses) to RGB color (which face_recognition uses)
frame = frame[:, :, ::-1]
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)

# Save each frame of the video to a list
frame_count += 1
Expand Down