Mat和written image是不一样的
Mat and written image are not same
我在程序中创建了一个Mat
变量,但是当我将它直接传递给函数时,它与我使用imwrite
编写它并再次使用imread
在函数中读取它相比具有不同的方式。
为什么会这样?
对我来说,正确的形式是当我写入和读取图像时,但在这种情况下,程序必须访问硬2次,这会使程序变慢。我如何防止它并直接使用我的Mat
变量?
如果您不需要使用任何其他应用程序查看您的图像,您可以使用OpenCV的内置FileStorage实现将Mat对象写入XML/YAML类。下面是一个示例:-
//Writing
cv::FileStorage fs;
fs.open(filename, cv::FileStorage::WRITE);
fs<<"MyImage"<<Image1;
//Reading
fs.open(filename, cv::FileStorage::READ);
fs["MyImage"]>>Image1;
fs.release(); //Very Important
相关文章:
- 自制的上衣:看起来一样,但不完全相同
- 为什么将两个对象分配给另一个对象后,两个对象不一样?
- 为什么向量不支持 size 作为成员变量,就像 Java 类中的长度变量一样,而是函数 size()?
- 如何创建像标准库头一样的头,以便在不链接头中函数的所有对象文件的情况下编译程序?
- 2D数组值像数组一样传递,0不打印
- C++ x+=1 x++ 和 x = x +1 是不一样的
- 为什么重新执行我的多线程代码后输出不一样
- 发布的应用程序与原始应用程序不一样
- 上传的文件和原来的不一样
- 输入Std::cin与直接赋值Std::string变量不一样
- 为什么每次执行这个程序的CPU时间都不一样
- 高斯生成的核和书中给出的不一样.为什么?
- 为什么保存到文件和加载的时间(NULL)和仅仅时间(NULL)是不一样的
- &(*similarObject) 和 similarObject 之间的区别?它们不一样吗?
- DLL函数名与导出的不一样
- 多次调用同一对象的析构函数,其结果与标准中描述的不一样
- 位字段大小与预期不一样,原因是什么
- .pdb中的函数地址与.exe中的不一样,为什么?
- Mat和written image是不一样的
- dynamic_cast的行为与APP_STL:=gnustl_static不一样