{"cells":[{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"cell_type":"code","source":"\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\nimport os\nimport cv2\n\nimport glob\n# Any results you write to the current directory are saved as output.\nimport matplotlib.pyplot as plt","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"# Get all test videos\nfilenames = glob.glob('/kaggle/input/deepfake-detection-challenge/test_videos/*.mp4')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"v_cap = cv2.VideoCapture('/kaggle/input/deepfake-detection-challenge/test_videos/adohdulfwb.mp4')\nfor j in range(1):\n    success, vframe = v_cap.read()\n","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"vframe = cv2.cvtColor(vframe,cv2.COLOR_BGR2RGB)\nplt.imshow(vframe)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"face_cascade = cv2.CascadeClassifier('/kaggle/input/haarcascadefrontalfaces/haarcascade_frontalface_default.xml')\nface_cascade.load('/kaggle/input/haarcascadefrontalfaces/haarcascade_frontalface_default.xml')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"boxs = face_cascade.detectMultiScale(vframe)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"for box in boxs:\n    img = cv2.rectangle(vframe,(box[0],box[1]),(box[0]+box[2],box[1]+box[3]),(255,0,0),5)\nplt.imshow(img)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"face = vframe[boxs[0][1]:boxs[0][1]+boxs[0][3],boxs[0][0]:boxs[0][0]+boxs[0][2]]\nplt.imshow(face)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"","execution_count":null,"outputs":[]}],"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat":4,"nbformat_minor":1}