OpenCV_01 数据保存
函数解读
- 图像保存函数 imwrite
bool imwrite( const String& filename, InputArray img,
const std::vector<int>& params = std::vector<int>());
// filename:图片地址和文件名
// img:将要保存的Mat矩阵
// params: 保存图片格式属性设置标志
//params 用法:
/*
std::vector<int> compression_params;
compression_params.push_back(cv::IMWRITE_PNG_COMPRESSION); //(见ImwriteFlags)
compression_params.push_back(9);
*/
- imwrite函数第三个参数可选的标志
//! Imwrite flags
enum ImwriteFlags {
IMWRITE_JPEG_QUALITY = 1, //!< For JPEG, it can be a quality from 0 to 100 (the higher is the better). Default value is 95.
IMWRITE_JPEG_PROGRESSIVE = 2, //!< Enable JPEG features, 0 or 1, default is False.
IMWRITE_JPEG_OPTIMIZE = 3, //!< Enable JPEG features, 0 or 1, default is False.
IMWRITE_JPEG_RST_INTERVAL = 4, //!< JPEG restart interval, 0 - 65535, default is 0 - no restart.
IMWRITE_JPEG_LUMA_QUALITY = 5, //!< Separate luma quality level, 0 - 100, default is 0 - don't use.
IMWRITE_JPEG_CHROMA_QUALITY = 6, //!< Separate chroma quality level, 0 - 100, default is 0 - don't use.