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: straighten.py
Close
import cv2 import numpy as np import sys import os def get_rotation_angle(image): gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) blurred = cv2.GaussianBlur(gray, (5, 5), 0) edged = cv2.Canny(blurred, 50, 150) contours, _ = cv2.findContours(edged, cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE) largest_contour = max(contours, key=cv2.contourArea) rect = cv2.minAreaRect(largest_contour) angle = rect[-1] if angle < -45: angle = 90 + angle return -angle def rotate_image(image, angle): (h, w) = image.shape[:2] center = (w // 2, h // 2) M = cv2.getRotationMatrix2D(center, angle, 1.0) rotated = cv2.warpAffine(image, M, (w, h), flags=cv2.INTER_CUBIC, borderMode=cv2.BORDER_REPLICATE) return rotated if __name__ == "__main__": if len(sys.argv) != 2: print("Usage: python straighten_image.py <path_to_image>") sys.exit(1) image_path = sys.argv[1] image = cv2.imread(image_path) if image is None: print(f"Error: Could not read image {image_path}") sys.exit(1) angle = get_rotation_angle(image) print(f"[INFO] Rotation angle: {angle:.2f} degrees") rotated_image = rotate_image(image, angle) output_path = os.path.splitext(image_path)[0] + '_straightened.jpg' cv2.imwrite(output_path, rotated_image) print(f"[INFO] Saved straightened image to {output_path}")