OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
hps
/
faces
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/26/2024 01:24:56 PM
rw-r--r--
📁
.ipynb_checkpoints
-
10/26/2024 01:24:58 PM
rwxr-xr-x
📁
.venv
-
10/26/2024 01:25:02 PM
rwxr-xr-x
📄
app.py
1008 bytes
10/26/2024 01:24:56 PM
rw-r--r--
📄
crop.py
1.5 KB
10/26/2024 01:24:56 PM
rw-r--r--
📄
crop.py.zip
913 bytes
10/26/2024 01:24:56 PM
rw-r--r--
📁
detected
-
10/28/2024 09:39:25 AM
rwxr-xr-x
📁
faces
-
10/26/2024 01:25:02 PM
rwxr-xr-x
📄
faces.sh
98 bytes
10/26/2024 01:24:56 PM
rw-r--r--
📄
find_faces.py
1.42 KB
10/28/2024 09:35:38 AM
rw-r--r--
📁
img
-
10/26/2024 01:24:59 PM
rwxr-xr-x
📄
index.html
1.12 KB
10/26/2024 01:24:56 PM
rw-r--r--
📄
index3.html
5.93 KB
10/26/2024 01:24:57 PM
rw-r--r--
📄
new.py
128 bytes
10/26/2024 01:24:57 PM
rw-r--r--
📄
newtest.php
1.34 KB
10/26/2024 01:24:57 PM
rw-r--r--
📄
people_with_phones.png
88.37 KB
10/26/2024 01:24:57 PM
rw-r--r--
📄
requirements.txt
33 bytes
10/26/2024 01:24:57 PM
rw-r--r--
📄
runpy.php
351 bytes
10/26/2024 01:24:57 PM
rw-r--r--
📄
straighten.py
1.38 KB
10/26/2024 01:24:57 PM
rw-r--r--
📄
test_faces_detected.jpg
2.98 MB
10/26/2024 01:24:58 PM
rw-r--r--
📄
testing.ipynb
6.74 KB
10/26/2024 01:24:57 PM
rw-r--r--
📄
upload.html
1.41 KB
10/28/2024 09:11:41 AM
rw-r--r--
📄
upload.php
4.48 KB
10/28/2024 09:41:43 AM
rw-r--r--
📁
uploads
-
10/28/2024 09:41:46 AM
rwxrwxrwx
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)