i would like to know if there is a right implementation for using ORB or SIFT w/ cv2.warpPerspective in order to get a better result, I’m using these code to get the psnr for comparing the original disp1 with the depth map I generated:
def psnr(img1, img2):
mse = numpy.mean( ((img1 - img2)) ** 2 )
if mse == 0:
return ‘INF’
PIXEL_MAX = 255.0
return 20 * math.log10(PIXEL_MAX / math.sqrt(mse))
test_imgs = [“Art”, “Dolls”, “Reindeer”]
for index in range(1):
gt_names = “./gt/”+test_imgs[index]+"/disp1.png";
gt_img = numpy.array(Image.open(gt_names),dtype=float);
print(gt_img.shape)
pred_names = "./pred/"+test_imgs[index]+"/disp1.png";
pred_img = numpy.array(Image.open(pred_names),dtype=float);
print(pred_img.shape)
[h,l] = gt_img.shape
gt_img = gt_img[:, 250:l]
pred_img = pred_img[:, 250:l]
pred_img[gt_img==0]= 0
peaksnr = psnr(pred_img,gt_img);
print('The Peak-SNR value is %0.4f \n', peaksnr);