├── 906_img_.png ├── An underwater color image quality evaluation metric.pdf ├── LICENSE ├── README.md ├── UCIQE.py ├── images ├── from_paper.jpg └── result.jpg └── requirements.txt /906_img_.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TongJiayan/UCIQE-python/1170aa29c48c33123532214d1bce9e48b26a5045/906_img_.png -------------------------------------------------------------------------------- /An underwater color image quality evaluation metric.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TongJiayan/UCIQE-python/1170aa29c48c33123532214d1bce9e48b26a5045/An underwater color image quality evaluation metric.pdf -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 TongJiayan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Underwater image quality evalution methods 2 | This is an implementation of UCIQE by python3.7. The original paper by Yang, Miao, and Arcot Sowmya can be found [here](https://ieeexplore.ieee.org/abstract/document/7300447). 3 | 4 | # Requirements 5 | You will need python3 as well as all the packages in the requirements.txt file. 6 | ``` 7 | pip3 install -r requirements.txt 8 | ``` 9 | # verification(906_img_.jpg for example) 10 | ## UCIQE on paper 11 | ![](images/from_paper.jpg) 12 | ## UCIQE computed 13 | ![](images/result.jpg) 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /UCIQE.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import cv2 3 | 4 | def getUCIQE(img): 5 | img_BGR = cv2.imread(img) 6 | img_LAB = cv2.cvtColor(img_BGR, cv2.COLOR_BGR2LAB) 7 | img_LAB = np.array(img_LAB,dtype=np.float64) 8 | # Trained coefficients are c1=0.4680, c2=0.2745, c3=0.2576 according to paper. 9 | coe_Metric = [0.4680, 0.2745, 0.2576] 10 | 11 | img_lum = img_LAB[:,:,0]/255.0 12 | img_a = img_LAB[:,:,1]/255.0 13 | img_b = img_LAB[:,:,2]/255.0 14 | 15 | # item-1 16 | chroma = np.sqrt(np.square(img_a)+np.square(img_b)) 17 | sigma_c = np.std(chroma) 18 | 19 | # item-2 20 | img_lum = img_lum.flatten() 21 | sorted_index = np.argsort(img_lum) 22 | top_index = sorted_index[int(len(img_lum)*0.99)] 23 | bottom_index = sorted_index[int(len(img_lum)*0.01)] 24 | con_lum = img_lum[top_index] - img_lum[bottom_index] 25 | 26 | # item-3 27 | chroma = chroma.flatten() 28 | sat = np.divide(chroma, img_lum, out=np.zeros_like(chroma, dtype=np.float64), where=img_lum!=0) 29 | avg_sat = np.mean(sat) 30 | 31 | uciqe = sigma_c*coe_Metric[0] + con_lum*coe_Metric[1] + avg_sat*coe_Metric[2] 32 | return uciqe 33 | 34 | if __name__ == '__main__': 35 | img = '906_img_.png' 36 | uciqe = getUCIQE(img) 37 | print("UCIQE of image '{0}' = {1}".format(img,uciqe)) -------------------------------------------------------------------------------- /images/from_paper.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TongJiayan/UCIQE-python/1170aa29c48c33123532214d1bce9e48b26a5045/images/from_paper.jpg -------------------------------------------------------------------------------- /images/result.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TongJiayan/UCIQE-python/1170aa29c48c33123532214d1bce9e48b26a5045/images/result.jpg -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | python-opencv 2 | numpy --------------------------------------------------------------------------------