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); });
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .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语句:使用策略模式优化代码结构