Skip to content

Commit

Permalink
- Solved `ImportError: cannot import name 'convert_dict_qtables' from…
Browse files Browse the repository at this point in the history
… 'PIL.JpegImagePlugin'` error (#72)

- Avoid clipping when importing RAW files (#86)
- Added Image Resampling tool (#88)
- Updated README.md
  • Loading branch information
GuidoBartoli committed Jun 20, 2024
1 parent 8ecde49 commit 37eb1c5
Show file tree
Hide file tree
Showing 9 changed files with 640 additions and 692 deletions.
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,8 @@ $ brew install libmagic

## [3/4] Install dependencies

### Linux
```console
$ pip install -r requirements.txt
```

### Windows
```console
C:\> pip install -r requirements_win.txt
pip install -r requirements.txt
```

## [4/4] Launch program
Expand Down
5 changes: 3 additions & 2 deletions gui/noiseprint/post_em.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import numpy as np
import numpy.linalg as numpyl
from scipy.ndimage.filters import uniform_filter, maximum_filter
import skimage.morphology as ski

This comment has been minimized.

Copy link
@Ray9T

Ray9T Jun 20, 2024

Edited images are no longer showing noise anomalies after this change. We are seeing uniform noise in this version, while the previous 0.85c version was great at picking noise anomalies.

Now even known manipulated images appear like unaltered ones.

import cv2 as cv

from .feat_spam.spam_np_opt import getSpamRes
from .utility.gaussianMixture import gm
Expand Down Expand Up @@ -61,7 +61,8 @@ def getWeights(img, res):

th_White = 253.0 / 256
rd_White = 3
sat_mask = ski.binary_opening(img > th_White, ski.disk(rd_White))
kernel = cv.getStructuringElement(cv.MORPH_ELLIPSE, (rd_White, rd_White))
sat_mask = cv.morphologyEx((img > th_White).astype(np.uint8), cv.MORPH_OPEN, kernel)

This comment has been minimized.

Copy link
@Ray9T

Ray9T Jun 20, 2024

Compared to SciPy/Ski, some consider CV to be inferior for morphological operations as CV is optimized for speed, and not so much on precision, although some might disagree.
I have examples to show how the new version using CV is unable to detect the noise issues.

mm = np.logical_or(mm, sat_mask)
mm = maximum_filter(mm, (win_z, win_z))
weights = np.logical_not(mm)
Expand Down
1 change: 0 additions & 1 deletion gui/noiseprint/utility/utilityRead.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
# http:https://www.grip.unina.it/download/LICENSE_OPEN.txt
#

from PIL.JpegImagePlugin import convert_dict_qtables
from PIL import Image
import numpy as np

Expand Down
1 change: 0 additions & 1 deletion gui/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ pandas==1.5.0
pyside6==6.4.0.1
python-magic==0.4.27
rawpy==0.17.3
scikit-image==0.22.0
scikit-learn==1.5.0
sewar==0.4.5
tensorflow==2.12.0
Expand Down
17 changes: 0 additions & 17 deletions gui/requirements_win.txt

This file was deleted.

616 changes: 0 additions & 616 deletions gui/resammpling.py

This file was deleted.

680 changes: 634 additions & 46 deletions gui/resampling.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion gui/sherloq.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
from utility import modify_font, load_image
from wavelets import WaveletWidget
from ghostmmaps import GhostmapWidget
from resammpling import ResamplingWidget
from resampling import ResamplingWidget

class MainWindow(QMainWindow):
max_recent = 5
Expand Down
2 changes: 1 addition & 1 deletion gui/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def load_image(parent, filename=None):
ext = os.path.splitext(filename)[1][1:].lower()
if ext in raw_exts:
with rawpy.imread(filename) as raw:
image = cv.cvtColor(raw.postprocess(use_auto_wb=True), cv.COLOR_RGB2BGR)
image = cv.cvtColor(raw.postprocess(use_auto_wb=True, auto_bright_thr=0), cv.COLOR_RGB2BGR)
elif ext == "gif":
capture = cv.VideoCapture(filename)
frames = int(capture.get(cv.CAP_PROP_FRAME_COUNT))
Expand Down

0 comments on commit 37eb1c5

Please sign in to comment.