OpenCV笔记

imread参数设置:
CV_LOAD_IMAGE_UNCHANGED -1 原始图像
CV_LOAD_IMAGE_GRAYSCALE 0 灰度图像
CV_LOAD_IMAGE_COLOR 1 彩色(默认值)
CV_LOAD_IMAGE_ANYDEPTH 2 任何彩度
CV_LOAD_IMAGE_ANYCOLOR 4 任何彩色
复制代码

imwrite参数设置: Format-specific save parameters encoded as pairs paramId, paramValue

For JPEG, it can be a quality ( CV_IMWRITE_JPEG_QUALITY ) from 0 to 100 (the higher is the better). Default value is 95.

For PNG, it can be the compression level ( CV_IMWRITE_PNG_COMPRESSION ) from 0 to 9. A higher value means a smaller size and longer compression time. Default value is 3.

For PPM, PGM, or PBM, it can be a binary format flag ( CV_IMWRITE_PXM_BINARY ), 0 or 1. Default value is 1.

Note:
The function imwrite saves the image to the specified file. The image format is chosen based on the filename extension (see imread() for the list of extensions). Only 8-bit (or 16-bit unsigned (CV_16U) in case of PNG, JPEG 2000, and TIFF) single-channel or 3-channel (with ‘BGR’ channel order) images can be saved using this function. If the format, depth or channel order is different, use Mat::convertTo() , and cvtColor() to convert it before saving. Or, use the universal FileStorage I/O functions to save the image to XML or YAML format.

复制代码

OpenCV多版本安装(放弃了,各种问题):

查看opencv版本:
pkg-config --modversion opencv

安装OpenCV2.4.9

使用apt-get install libopencv-dev安装的默认为2.4.9(Ubuntu16.04)

OpenCV画好看的圈圈(关键点):

std::for_each(keypoints.begin(), keypoints.end(), [&](cv::KeyPoint i){
    cv::RNG& random_rng = cv::theRNG();
    cv::Scalar random_color = cv::Scalar(random_rng(256), random_rng(256), random_rng(256));
    cv::circle(img_fast_opencv, cv::Point2f(i.pt.x, i.pt.y), 3, random_color, 1, cv::LINE_AA, 0);
    });

 

 

posted on   萝卜丶爱  阅读(137)  评论(0编辑  收藏  举报

编辑推荐:
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示