Skip to content

Commit 0dabfbf

Browse files
committed
dependency bump, dropped image anonimization
1 parent 2f0b490 commit 0dabfbf

File tree

3 files changed

+9
-3703
lines changed

3 files changed

+9
-3703
lines changed

setup.cfg

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
[metadata]
66
name = dataset-image-annotator
7-
version = 0.0.24
7+
version = 0.0.25
88
description = Image annotation tool
99
author = Oleg Korsak
1010
author_email = [email protected]
@@ -34,12 +34,12 @@ setup_requires = pyscaffold>=3.2a0,<3.3a0
3434
install_requires =
3535
rawpy==0.18.0
3636
Pillow==9.4.0
37-
pydantic==1.10.4
37+
pydantic==1.10.5
3838
tzdata==2022.7
3939
# The usage of test_requires is discouraged, see `Dependency Management` docs
4040
# tests_require = pytest; pytest-cov
4141
# Require a specific Python version, e.g. Python 2.7 or >= 3.4
42-
python_requires = >=3.10
42+
python_requires = >=3.11
4343

4444
[options.packages.find]
4545
where = src
@@ -54,20 +54,19 @@ exclude =
5454
desktop =
5555
PySide6-Essentials==6.4.2
5656
web =
57-
alembic==1.9.3
57+
alembic==1.9.4
5858
asyncpg==0.27.0
5959
Authlib==1.2.0
6060
passlib==1.7.4
6161
databases[postgresql]==0.7.0
62-
fastapi==0.90.0
63-
fastapi-pagination==0.11.3
64-
fastapi-users[sqlalchemy]==10.3.0
65-
numpy==1.24.1
66-
orjson==3.8.5
62+
fastapi==0.92.0
63+
fastapi-pagination==0.11.4
64+
fastapi-users[sqlalchemy]==10.4.0
65+
numpy==1.24.2
66+
orjson==3.8.6
6767
passlib[argon2]==1.7.4
6868
PyJWT==2.6.0
6969
python-dateutil==2.8.2
70-
python-opencv==4.7.0.68
7170
python3-commons>=0.0.1
7271
SQLAlchemy==1.4.46
7372
uvicorn[standard]==0.20.0

src/dataset_image_annotator/__main__.py

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from pathlib import Path
88
from typing import Sequence, Mapping
99

10-
import cv2
1110
import numpy as np
1211
import rawpy
1312
from PySide6.QtCore import QFile, QIODevice, QDir, QFileInfo, QModelIndex, Qt, QStringListModel
@@ -87,46 +86,8 @@ def get_raw_thumbnail(path: Path):
8786
return thumb
8887

8988

90-
def anonymize_image(image):
91-
# Convert the image to grayscale
92-
decoded_image = cv2.imdecode(np.frombuffer(image.data, np.uint8), -1)
93-
gray = cv2.cvtColor(decoded_image, cv2.COLOR_BGR2GRAY)
94-
95-
# Load the cascade classifier for detecting cars
96-
cascades = (
97-
str(Path(Path(__file__).parent, 'cars.xml')),
98-
str(Path(cv2.data.haarcascades, 'haarcascade_russian_plate_number.xml'))
99-
)
100-
101-
for cascade in cascades:
102-
car_cascade = cv2.CascadeClassifier(cascade)
103-
104-
# Detect cars in the image
105-
cars = car_cascade.detectMultiScale(gray, 1.1, 1)
106-
107-
# Iterate over the detected cars
108-
for (x, y, w, h) in cars:
109-
# Blur the license plate
110-
decoded_image[y + h - 20:y + h, x:x + w] = cv2.GaussianBlur(
111-
decoded_image[y + h - 20:y + h, x:x + w], (23, 23), 30)
112-
113-
# Load the cascade classifier for detecting faces
114-
face_cascade = cv2.CascadeClassifier(str(Path(cv2.data.haarcascades, 'haarcascade_frontalface_default.xml')))
115-
116-
# Detect faces in the image
117-
faces = face_cascade.detectMultiScale(gray, 1.3, 5)
118-
119-
# Iterate over the detected faces
120-
for (x, y, w, h) in faces:
121-
# Blur the face
122-
decoded_image[y:y + h, x:x + w] = cv2.GaussianBlur(decoded_image[y:y + h, x:x + w], (23, 23), 30)
123-
124-
return cv2.imencode('.jpg', decoded_image)[1].tobytes()
125-
126-
12789
def generate_thumbnail(thumbnail_dir_path: Path, path: Path) -> QPixmap:
12890
thumbnail = get_raw_thumbnail(path)
129-
thumbnail = anonymize_image(thumbnail)
13091

13192
thumb_pixmap = QPixmap()
13293
thumb_pixmap.loadFromData(thumbnail)

0 commit comments

Comments
 (0)