<jupyter_start><jupyter_text>1st is Eye Detection without Face Detection<jupyter_code>#main()
#USING FACE FRAME

def main2():
    i = 0
   
    
    #url = "https://192.168.21.168:8080/video"
    
    #cap = cv2.VideoCapture(url)
    cap = cv2.VideoCapture(0)
    
    #time.sleep(2.000)
    cv2.namedWindow('image')
   # cv2.createTrackbar('threshold', 'image', 0, 255, nothing)
    while True:
        _, frame = cap.read()

        
        face_frame = detect_faces(frame, face_cascade)
        if face_frame is not None:
            eyes = detect_eyes(face_frame, eye_cascade)
            for eye in eyes:
                if eye is not None:
                    pp = cv2.imread('face_frame',0)  #pass 0 to convert into gray level 
                    threshold = cv2.threshold(pp, 0, 255, cv2.THRESH_OTSU) #cv2.getTrackbarPos('threshold', 'image')
                    eye = cut_eyebrows(eye)
                    keypoints = blob_process(eye, threshold, detector)
                    #print(type(keypoints))
                    eye = cv2.drawKeypoints(eye, keypoints, eye, (0, 0, 255), cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)
                    if bool(keypoints) == 0:
                        i = i + 1
                        #print(type(keypoints))
                        
                    elif bool(keypoints) == 1:
                        i = 0
                        
                    if i == 70:
                        print("WCJG C,lkuwcq bcycblqcnwhklu cbwuqyl %killbgscriptswqc")
                        #playsound('beep sound.mp3')
                        #print('playing sound using  playsound')
                        i = 0
                        
        cv2.imshow('image', frame)
        if cv2.waitKey(2) & 0xFF == ord('q'):
            break
    cap.release()
    cv2.destroyAllWindows()<jupyter_output><empty_output><jupyter_text>2nd is Eye Detection by first using Face Detection<jupyter_code>#main2()
#pip freeze
#USING FACE FRAME
#import numpy as np
import os
#import cv2


filename = 'video.avi'
frames_per_second = 24.0
res = '720p'

# Set resolution for the video capture

def change_res(cap, width, height):
    cap.set(3, width)
    cap.set(4, height)

# Standard Video Dimensions Sizes
STD_DIMENSIONS =  {
    "480p": (640, 480),
    "720p": (1280, 720),
    "1080p": (1920, 1080),
    "4k": (3840, 2160),
}


# grab resolution dimensions and set video capture to it.
def get_dims(cap, res='1080p'):
    width, height = STD_DIMENSIONS["480p"]
    if res in STD_DIMENSIONS:
        width,height = STD_DIMENSIONS[res]
    ## change the current caputre device
    ## to the resulting resolution
    change_res(cap, width, height)
    return width, height

# Video Encoding, might require additional installs
# Types of Codes: http://www.fourcc.org/codecs.php
VIDEO_TYPE = {
    'avi': cv2.VideoWriter_fourcc(*'XVID'),
    #'mp4': cv2.VideoWriter_fourcc(*'H264'),
    'mp4': cv2.VideoWriter_fourcc(*'XVID'),
}

def get_video_type(filename):
    filename, ext = os.path.splitext(filename)
    if ext in VIDEO_TYPE:
      return  VIDEO_TYPE[ext]
    return VIDEO_TYPE['avi']



cap = cv2.VideoCapture(0)
out = cv2.VideoWriter(filename, get_video_type(filename), 25, get_dims(cap, res))

while True:
    ret, frame = cap.read()
    face_frame = detect_faces(frame, face_cascade)
    if face_frame is not None:
        eyes = detect_eyes(face_frame, eye_cascade)
        for eye in eyes:
            if eye is not None:
                pp = cv2.imread('face_frame',0)  #pass 0 to convert into gray level 
                threshold = cv2.threshold(pp, 0, 255, cv2.THRESH_OTSU) #cv2.getTrackbarPos('threshold', 'image')
                eye = cut_eyebrows(eye)
                keypoints = blob_process(eye, threshold, detector)
                #print(type(keypoints))
                eye = cv2.drawKeypoints(eye, keypoints, eye, (0, 0, 255), cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)
                        
    out.write(frame)
    #cv2.imshow('frame',frame)
    if cv2.waitKey(2) & 0xFF == ord('q'):
        os._exit(00)
        break
cap.release()
out.release()
#cv2.destroyAllWindows()
os._exit(00)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11313518696069032, 'fraction_numerical': 0.03787152444870566, 'mean_word_length': 2.1879297173414822, 'pattern_counts': {'":': 4, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '168084', 'license': 'Apache-2.0', 'n_tokens_mistral': 1535, 'n_tokens_neox': 1364, 'n_words': 319, 'path': 'Eye Detection v3.1.2.ipynb', 'repo_name': 'DhruvM321/sleepy-eye-tracker', 'size': '4172'}