make images' path specific (#671)

fixed wrong image's path while debuggin in VSCode
This commit is contained in:
raksa 2018-12-26 20:06:34 +07:00 committed by Libin Yang
parent f6d241e52d
commit ad0bc2bb8b

View File

@ -4,6 +4,7 @@
""" """
import math import math
import os
import cv2 import cv2
import numpy as np import numpy as np
@ -18,13 +19,13 @@ def psnr(original, contrast):
def main(): def main():
dir_path = os.path.dirname(os.path.realpath(__file__))
# Loading images (original image and compressed image) # Loading images (original image and compressed image)
original = cv2.imread('original_image.png') original = cv2.imread(os.path.join(dir_path, 'original_image.png'))
contrast = cv2.imread('compressed_image.png', 1) contrast = cv2.imread(os.path.join(dir_path, 'compressed_image.png'), 1)
original2 = cv2.imread('PSNR-example-base.png') original2 = cv2.imread(os.path.join(dir_path, 'PSNR-example-base.png'))
contrast2 = cv2.imread('PSNR-example-comp-10.jpg', 1) contrast2 = cv2.imread(os.path.join(dir_path, 'PSNR-example-comp-10.jpg'), 1)
# Value expected: 29.73dB # Value expected: 29.73dB
print("-- First Test --") print("-- First Test --")