当前位置:网站首页>Opencv saves pictures in the specified format
Opencv saves pictures in the specified format
2022-07-26 03:12:00 【Xuan yanru Liu】
Save the image locally , In the specified format , Need to use cv::imwrite() function
The function prototype :
bool imwrite(const string& filename, InputArray img,
const vector<int>& params=vector<int>() )
Parameter interpretation :filename: Image saving path , Its suffix Represents the format to be saved .
img:Mat Variable
params: For specific formats , You can set some properties . such as , Save as JPEG2000 when , It can be used params Set the compression ratio , And you can set multiple properties at the same time , Just follow paramId_1, paramValue_1, paramId_2, paramValue_2, … . This format .( It's kind of like matlab Key - It's worth it )
at present , The supported image formats are
Enclosed Source link , For inquiry, please refer to .
for instance , take png The image is saved as JPEG2000 Format , The compression ratio is 0.5
#include <iostream>
#include <libavutil/avutil.h>
#include <opencv2/highgui.hpp>
#include <opencv4/opencv2/imgproc.hpp>
#include <vector>
using namespace cv;
using namespace std;
int main()
{
Mat img;
img = imread("/home/lfh/ picture / wallpaper / Qinnv .png");
imshow("image",img);
vector<int> compression_params;
compression_params.push_back(IMWRITE_JPEG2000_COMPRESSION_X1000);
compression_params.push_back(500); //0.5*1000
imwrite(" Qinnv .jp2",img,compression_params);
waitKey(0);
}
边栏推荐
- 一篇文章让你理解 云原生 容器化相关
- Oxycon 2022 network capture frontier conference is about to open!
- [C language] deeply understand integer lifting and arithmetic conversion
- (九)属性自省
- An article allows you to understand the relevance of cloud native containerization
- Arthas view the source code of the loaded class (JAD)
- canvas——绘制曲线——挂钟,饼图,五角星
- Safety margin of mass consumption
- STM32 - DMA notes
- Arthas download and startup
猜你喜欢

Influence of middle tap change on ZVS oscillation circuit

Leetcode · 83 biweekly match · 6128. best poker hand · simulation

LeetCode·

Detailed explanation of extended physics informedneural networks paper
![[sql] usage of self connection](/img/92/92474343b4b4e6ea60453b4799cb55.jpg)
[sql] usage of self connection

My friend took 25koffer as soon as he learned automation test. When will my function test end?

【尤里复裂人】带你轻松理解——深拷贝和浅拷贝

Win11 method of changing disk drive letter

(九)属性自省

【无标题】
随机推荐
Quick check of OGC WebGIS common service standards (wms/wmts/tms/wfs)
(9) Attribute introspection
[NOIP2001 普及组]装箱问题
JSD-2204-酷鲨商城(管理商品模块)-Day02
【TensorFlow&PyTorch】图像数据增强API
Unity quickly builds urban scenes
JVM memory model parsing
Execution process behind shell commands
如何正确计算 Kubernetes 容器 CPU 使用率
Get twice the result with half the effort: learn the web performance test case design model
Arthas' dynamic load class (retransform)
GoLang日志编程系统
Golang log programming system
Software testing post: Ali has three sides. Fortunately, he has made full preparations and has been offered
【C语言】深入理解 整型提升 和 算术转换
"Xiao Deng's view" the value brought by Siem to enterprises (II)
Influence of middle tap change on ZVS oscillation circuit
Win11麦克风权限的开启方法
canvas——绘制曲线——挂钟,饼图,五角星
Standardize your own debug process