Open seannz opened 4 years ago
I just checked again, and cv::imread returns a matrix with the correct number of channels. However, if you check from within calc_psnr(), image1 and image2 are 4-channel matrices (this is true even for grayscale images).
Hello, seannz-san,
Thanks for your comments! I've checked the latest rep with a slight modification of setting to OpenCV4.2 and VS2017. The results seem to be good as far as I trace. I mean a matrix after imread() and two matrices in calc_psnr() are 3ch images when loading a 3ch PNG image (I check the bit-depth is 24 from file property dialog). May I ask you to send me an image file you are using?
Here's an image that I used for testing: http://r0k.us/graphics/kodak/kodak/kodim01.png
Thank you!
I've tested the image and got the correct results (all the matrices mentioned above are 3-channel). I'm not sure why your code produces 4-channel images, but I'm happy if you correctly modify the code when seeing this strange behavior. Thanks!
Sugimoto-san,
There seems to be an issue with the PSNR calculation in the C++ version. In the main.cpp::test_bilateral_filter function, cv::imread returns a 4-channel matrix even when a 3-channel (RGB) PNG is loaded (the 4th channel seems to be an empty alpha channel). As a result, the MSE is under-reported by a factor of ~4/3=1.333, making PSNR also seem higher.
Best, Sean Young,