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: testing.ipynb
Close
{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "f41971b1-687d-417d-b87f-120ed419d09f", "metadata": {}, "outputs": [], "source": [ "import cv2\n", "import sys" ] }, { "cell_type": "code", "execution_count": 7, "id": "0e0c92e9-f781-47e8-960e-2f8a2ddc5778", "metadata": {}, "outputs": [], "source": [ "# imagePath = sys.argv[1]\n", "\n", "# imagePath = 'C:/xampp/htdocs/hps/faces/people_with_phones.png'\n", "imagePath = 'C:/xampp/htdocs/hps/test.jpg'" ] }, { "cell_type": "code", "execution_count": 8, "id": "d9d1a188-75b0-4d03-b2e5-11c4dd860c92", "metadata": {}, "outputs": [], "source": [ "image = cv2.imread(imagePath)\n", "gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)" ] }, { "cell_type": "code", "execution_count": 9, "id": "d29203a4-651b-4402-a1f6-d27ce8712a4d", "metadata": {}, "outputs": [], "source": [ "image = cv2.imread(imagePath)\n", "if image is None:\n", " print(\"Failed to load image. Check the file path and format.\")\n", "else:\n", " gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)" ] }, { "cell_type": "code", "execution_count": 10, "id": "3dabae03-f3d5-4443-9d5a-1bd5c8da4e80", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Found 12 Faces!\n" ] } ], "source": [ "faceCascade = cv2.CascadeClassifier(cv2.data.haarcascades + \"haarcascade_frontalface_default.xml\")\n", "faces = faceCascade.detectMultiScale(\n", " gray,\n", " scaleFactor=1.3,\n", " minNeighbors=3,\n", " minSize=(30, 30)\n", ") \n", "\n", "print(\"Found {0} Faces!\".format(len(faces)))" ] }, { "cell_type": "code", "execution_count": 11, "id": "45a65f8b-71a1-46a6-a1e1-0b64a24ad749", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[[3704 2056 196 196]\n", " [3700 451 123 123]\n", " [3715 495 137 137]\n", " [2863 583 483 483]\n", " [1949 716 460 460]\n", " [2309 797 467 467]\n", " [1129 830 462 462]\n", " [3373 841 477 477]\n", " [4389 2382 105 105]\n", " [1427 1073 470 470]\n", " [4049 1023 116 116]\n", " [4379 1589 77 77]]\n" ] } ], "source": [ "print(faces)" ] }, { "cell_type": "code", "execution_count": 12, "id": "5dc8cf14-cfbc-4f2c-81db-b52201898e66", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[INFO] Object found. Saving locally.\n", "[INFO] Object found. Saving locally.\n", "[INFO] Object found. Saving locally.\n", "[INFO] Object found. Saving locally.\n", "[INFO] Object found. Saving locally.\n", "[INFO] Object found. Saving locally.\n", "[INFO] Object found. Saving locally.\n", "[INFO] Object found. Saving locally.\n", "[INFO] Object found. Saving locally.\n", "[INFO] Object found. Saving locally.\n", "[INFO] Object found. Saving locally.\n", "[INFO] Object found. Saving locally.\n" ] } ], "source": [ "for (x, y, w, h) in faces:\n", " cv2.rectangle(image, (x, y), (x + w, y + h), (0, 255, 0), 2)\n", " roi_color = image[y:y + h, x:x + w] \n", " print(\"[INFO] Object found. Saving locally.\") \n", " cv2.imwrite('test' + str(w) + str(h) + '_faces.jpg', roi_color) " ] }, { "cell_type": "code", "execution_count": 13, "id": "73170c3a-81a6-42c2-8b77-7ee62c336ea9", "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/plain": [ "array([[[201, 191, 184],\n", " [201, 191, 184],\n", " [199, 190, 181],\n", " ...,\n", " [156, 141, 125],\n", " [156, 141, 125],\n", " [156, 142, 124]],\n", "\n", " [[202, 192, 185],\n", " [201, 191, 184],\n", " [200, 191, 182],\n", " ...,\n", " [156, 141, 125],\n", " [156, 141, 125],\n", " [156, 142, 124]],\n", "\n", " [[202, 192, 185],\n", " [201, 191, 184],\n", " [200, 191, 182],\n", " ...,\n", " [156, 141, 125],\n", " [156, 141, 125],\n", " [156, 142, 124]],\n", "\n", " ...,\n", "\n", " [[110, 99, 85],\n", " [110, 99, 85],\n", " [110, 99, 85],\n", " ...,\n", " [112, 101, 93],\n", " [111, 100, 92],\n", " [111, 100, 92]],\n", "\n", " [[109, 98, 84],\n", " [109, 98, 84],\n", " [109, 98, 84],\n", " ...,\n", " [112, 101, 93],\n", " [112, 101, 93],\n", " [111, 100, 92]],\n", "\n", " [[113, 102, 88],\n", " [113, 102, 88],\n", " [113, 102, 88],\n", " ...,\n", " [108, 97, 89],\n", " [106, 95, 87],\n", " [105, 94, 86]]], dtype=uint8)" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "image" ] }, { "cell_type": "code", "execution_count": 14, "id": "b16b4394-12df-4a52-a26f-9ccf5f1ef807", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[INFO] Image faces_detected.jpg written to filesystem: True\n" ] } ], "source": [ "for (x, y, w, h) in faces:\n", " # Draw a green rectangle around the detected face\n", " cv2.rectangle(image, (x, y), (x + w, y + h), (0, 255, 0), 2)\n", "\n", "# Save the image with the green rectangles drawn\n", "status = cv2.imwrite('test_faces_detected.jpg', image)\n", "print(\"[INFO] Image faces_detected.jpg written to filesystem: \", status)" ] }, { "cell_type": "code", "execution_count": null, "id": "59eb1720-0095-471b-9d53-32f7d0851476", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.4" } }, "nbformat": 4, "nbformat_minor": 5 }