I have a very simple code to calculate PSNR, when I run it I am getting an exception.
void psnr()
{
try
{
Mat img = imread("TestImage.png");
Mat imgGray, imgCanny;
Canny(img, imgCanny, 15, 150);
cout << endl << "PSNR " << cv::PSNR(img, imgCanny);
}
catch (cv::Exception& ex)
{
cout << "Error " << ex.msg;
}
waitKey(0);
}
I am getting expection:
Error OpenCV(4.5.2) C:\build\master_winpack-build-win64-vc15\opencv\modules\core\src\norm.cpp:1279: error: (-215:Assertion failed) _src1.type() == _src2.type() in function 'cv::PSNR'
What could be the reason for the exception?