Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update BrightContrastModule.py #139

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions BrightContrastModule.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
import numpy as np
from skimage.filters import filters
from skimage.color import convert_colorspace, rgb2gray
from distutils.util import strtobool

Expand Down Expand Up @@ -56,4 +57,10 @@ def getContrast(s,params):
#RMS contrast
rms_contrast=np.sqrt(pow(img - img.mean(), 2).sum() / img.size)
s.addToPrintList("rms_contrast", str(rms_contrast))

#TenenGrad contrast
tmp = sobel(img)
Copy link
Owner

@choosehappy choosehappy Jul 24, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking at this sobel(img)

doesn't this assume that img is a matrix?

Above, if limit_to_mask is true:

    if (limit_to_mask):
        img = img[s["img_mask_use"]]

isn't img then a vector, as its been indexed by a binary mask matrix, and not a 2d array/matrix?

tenenGrad_contrast=np.sqrt(np.sum(tmp**2))/img.size
s.addToPrintList("tenenGrad_contrast", str(tenenGrad_contrast))

return