Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Actually, I found the problem. My problem was when I read the image, i didnt put the '0' in the flag. Then, I tried to change everything to CV_8U and then i found the PSNR.

double psnr1;
Mat error1, error2, frame1,frame2;
frame1 = vframes[1];
frame2 = vframes[2];
absdiff(frame1,frame2,error1);
imwrite("error.jpeg",error1);
error2 = imread("error.jpeg",0);
error1.convertTo(error1, CV_8U);
error2.convertTo(error2, CV_8U);
psnr1 = PSNR(error1,error2);
cout << psnr1 << endl;
waitKey(0);

@Tetragramm thanks for your help, I really appreciate it. You are the best in this forum.