OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
hps
/
bfaces
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
10/28/2024 10:38:34 AM
rwxr-xr-x
📄
.DS_Store
6 KB
10/24/2024 01:40:28 PM
rw-r--r--
📁
.ipynb_checkpoints
-
10/24/2024 01:40:37 PM
rwxr-xr-x
📁
.venv
-
10/24/2024 01:40:53 PM
rwxr-xr-x
📄
app.py
1008 bytes
10/24/2024 01:40:28 PM
rw-r--r--
📄
crop.py
1.5 KB
10/24/2024 01:40:28 PM
rw-r--r--
📄
crop.py.zip
913 bytes
10/24/2024 01:40:28 PM
rw-r--r--
📁
faces
-
10/24/2024 01:40:52 PM
rwxr-xr-x
📄
faces.sh
98 bytes
10/24/2024 01:40:29 PM
rw-r--r--
📄
faces_detected.jpg
177.95 KB
10/24/2024 01:40:29 PM
rw-r--r--
📁
img
-
10/24/2024 01:40:42 PM
rwxr-xr-x
📄
index.html
1.12 KB
10/24/2024 01:40:29 PM
rw-r--r--
📄
people_with_phones.png
88.37 KB
10/24/2024 01:40:29 PM
rw-r--r--
📄
people_with_phones_faces.jpg
8.57 KB
10/24/2024 01:40:30 PM
rw-r--r--
📄
requirements.txt
33 bytes
10/24/2024 01:40:30 PM
rw-r--r--
📄
straighten.py
1.38 KB
10/24/2024 01:40:30 PM
rw-r--r--
📄
test105105_faces.jpg
3.7 KB
10/24/2024 01:40:30 PM
rw-r--r--
📄
test116116_faces.jpg
5.22 KB
10/24/2024 01:40:31 PM
rw-r--r--
📄
test123123_faces.jpg
5.5 KB
10/24/2024 01:40:31 PM
rw-r--r--
📄
test137137_faces.jpg
7 KB
10/24/2024 01:40:31 PM
rw-r--r--
📄
test151151_faces.jpg
11.26 KB
10/24/2024 01:40:31 PM
rw-r--r--
📄
test196196_faces.jpg
9.02 KB
10/24/2024 01:40:32 PM
rw-r--r--
📄
test460460_faces.jpg
79.38 KB
10/24/2024 01:40:32 PM
rw-r--r--
📄
test462462_faces.jpg
76.62 KB
10/24/2024 01:40:32 PM
rw-r--r--
📄
test467467_faces.jpg
82.66 KB
10/24/2024 01:40:33 PM
rw-r--r--
📄
test470470_faces.jpg
83.53 KB
10/24/2024 01:40:33 PM
rw-r--r--
📄
test477477_faces.jpg
77.63 KB
10/24/2024 01:40:33 PM
rw-r--r--
📄
test483483_faces.jpg
81.52 KB
10/24/2024 01:40:33 PM
rw-r--r--
📄
test7777_faces.jpg
2.69 KB
10/24/2024 01:40:34 PM
rw-r--r--
📄
test8282_faces.jpg
4.3 KB
10/24/2024 01:40:34 PM
rw-r--r--
📄
test9999_faces.jpg
5.18 KB
10/24/2024 01:40:34 PM
rw-r--r--
📄
test_faces_detected.jpg
2.98 MB
10/24/2024 01:40:36 PM
rw-r--r--
📄
testing.ipynb
6.74 KB
10/24/2024 01:40:34 PM
rw-r--r--
Editing: crop.py
Close
import cv2 import sys import os # Define a margin (in pixels) MARGIN = 20 # Read the image path from command line arguments imagePath = sys.argv[1] imstr = os.path.splitext(imagePath)[0] # Read the image image = cv2.imread(imagePath) gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) # Load the pre-trained face detection model faceCascade = cv2.CascadeClassifier(cv2.data.haarcascades + "haarcascade_frontalface_default.xml") # Detect faces in the image faces = faceCascade.detectMultiScale( gray, scaleFactor=1.3, minNeighbors=3, minSize=(30, 30) ) print("[INFO] Found {0} Faces.".format(len(faces))) for (x, y, w, h) in faces: # Add margin to the bounding box coordinates x_margin = max(0, x - MARGIN) y_margin = max(0, y - MARGIN) w_margin = w + 2 * MARGIN h_margin = h + 2 * MARGIN # Ensure the new bounding box does not exceed the image dimensions x_margin = max(0, x_margin) y_margin = max(0, y_margin) w_margin = min(image.shape[1] - x_margin, w_margin) h_margin = min(image.shape[0] - y_margin, h_margin) # Crop the region of interest (ROI) with the margin roi_color = image[y_margin:y_margin + h_margin, x_margin:x_margin + w_margin] # Save the cropped face with a margin print("[INFO] Object found. Saving locally.") cv2.imwrite(imstr + '_faces_with_margin.jpg', roi_color) # Save the image with detected faces outlined status = cv2.imwrite('faces_detected.jpg', image) print("[INFO] Image faces_detected.jpg written to filesystem: ", status)