Skip to content

Commit

Permalink
Added condition to convert image to rgb only when it is rgb (ocampor#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
njay225 authored Feb 12, 2022
1 parent d548cde commit a0435e2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion imquality/brisque.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ def __init__(
sigma: float = 7 / 6,
):
self.image = pil2ndarray(image)
self.image = skimage.color.rgb2gray(self.image)

if self.image.shape[-1] == 3:
self.image = skimage.color.rgb2gray(self.image)

self.kernel_size = kernel_size
self.sigma = sigma
self.kernel = gaussian_kernel2d(kernel_size, sigma)
Expand Down

0 comments on commit a0435e2

Please sign in to comment.