起因
因为OpenCV不支持.pfm文件格式的操作,而middlebury提供的groundtruth一般为.pfm格式,为避免重复造轮子,就去github上找了大神提供的开源代码分享给大家。
轮子
github链接:https://github.com/antoinetlc/PFM_ReadWrite
例子
/** * Example of how to read and save PFM files. */ #include <iostream> #include <string> #include "PFMReadWrite.h" using namespace std; using namespace cv; int main(void) { //Example that loads an image and stores it under another name Mat image = loadPFM(string("image.pfm")); //Display the image imshow("Image", image); waitKey(0); savePFM(image, "image_saved.pfm"); return 0; }