Hello Mat

 找回密码
 立即注册
查看: 3470|回复: 0

png图像无损保存

[复制链接]

84

主题

115

帖子

731

金钱

管理员

Rank: 9Rank: 9Rank: 9

积分
1467
发表于 2021-4-7 21:40:34 | 显示全部楼层 |阅读模式
png图像无损保存
  1. std::vector<int> compression_params;
  2. compression_params.push_back(CV_IMWRITE_PNG_COMPRESSION);
  3. compression_params.push_back(0);    // 无压缩png.
  4. compression_params.push_back(cv::IMWRITE_PNG_STRATEGY);
  5. compression_params.push_back(cv::IMWRITE_PNG_STRATEGY_DEFAULT);  
  6. cv::imwrite("test.png", rgb_image, compression_params);
复制代码
如果CV_IMWRITE_PNG_COMPRESSION报错的话,试试IMWRITE_PNG_COMPRESSION


参考:
【1】OPencv无损保存图片
【2】opencv imwrite()函数保存png格式的图像

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Python|Opencv|MATLAB|Halcom.cn ( 蜀ICP备16027072号 )

GMT+8, 2024-4-19 17:42 , Processed in 0.233435 second(s), 21 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表