惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Simon Willison's Weblog
Simon Willison's Weblog
IT之家
IT之家
B
Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Stack Overflow Blog
Stack Overflow Blog
S
Schneier on Security
aimingoo的专栏
aimingoo的专栏
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
C
Check Point Blog
S
Securelist
博客园 - Franky
NISL@THU
NISL@THU
T
The Exploit Database - CXSecurity.com
Recent Announcements
Recent Announcements
The Cloudflare Blog
爱范儿
爱范儿
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
WordPress大学
WordPress大学
T
Troy Hunt's Blog
P
Proofpoint News Feed
Last Week in AI
Last Week in AI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
Tor Project blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
云风的 BLOG
云风的 BLOG
I
Intezer
腾讯CDC
V2EX - 技术
V2EX - 技术
Security Latest
Security Latest
H
Heimdal Security Blog
The Register - Security
The Register - Security
MongoDB | Blog
MongoDB | Blog
V
Visual Studio Blog
H
Hacker News: Front Page
Security Archives - TechRepublic
Security Archives - TechRepublic
阮一峰的网络日志
阮一峰的网络日志
T
Threat Research - Cisco Blogs
P
Proofpoint News Feed
Microsoft Azure Blog
Microsoft Azure Blog
V
V2EX
雷峰网
雷峰网
I
InfoQ
K
Kaspersky official blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
T
Tailwind CSS Blog
Hugging Face - Blog
Hugging Face - Blog
T
Threatpost
Microsoft Security Blog
Microsoft Security Blog
C
Cyber Attacks, Cyber Crime and Cyber Security

博客园 - 凤凰_1

多边形近似:最小周长多边形算法MPP 多阈值otsu的opencv实现 在Opencv中自定义了一个相位函数,获取复数矩阵的相位 cvIsInf与cvIsNan函数 Mandelbrot set 以parallel_for_实现 opencv的并行操作parallel_for_的问题 CV_WRAP和CV_EXPORTS_W opencv超级像素示例 opencv中自定义的双线性二次插值的图像旋转及缩放 在Qt中,如何在sheets末端添加新的sheet C++版DNN最简主体框架 C++版全连接神经网络 C++版加载MNIST图像集合 C++版的神经网络训练用的图像集合加载 c\c++宏定义,四个参数求最大值 - 凤凰_1 - 博客园 自定义c++二维动态数组 用Cmake 编译OpenCV常见的错误 Opencv中的dft()和idft()示例 C++仿Matlab的bsxfun函数
opencv4.x 中的plot函数绘制二维Mat
凤凰_1 · 2022-08-16 · via 博客园 - 凤凰_1

发现一个好玩的二维图像绘制函数,与大家共同欣赏:)

参考网址:OpenCV4入门061:使用plot2d绘制折线图 - 食铁兽 (feater.top)

头文件:

#include<opencv2/plot.hpp>

动态库:

-llibopencv_plot454d
int main()
{
    //准备一行51列的数据位置
    Mat data_x(1, 51, CV_64F);
    Mat data_y(1, 51, CV_64F);

    //填充模拟数据
    for (int i = 0; i < data_x.cols; i++) {
        double x                = (i - data_x.cols / 2);
        data_x.at<double>(0, i) = x;
        data_y.at<double>(0, i) = x * x * x;
    }

    std::cout << "data_x : " << data_x << std::endl;
    std::cout << "data_y : " << data_y << std::endl;

    Mat plot_result;

    Ptr<plot::Plot2d> plot=plot::Plot2d::create(data_x,data_y);
    plot->render(plot_result);
    imshow("plot 2d data in default way!",plot_result);
    //自定义参数
       plot->setShowText(false);
       plot->setShowGrid(false);
       plot->setPlotBackgroundColor(Scalar(255, 200, 200));
       plot->setPlotLineColor(Scalar(255, 0, 0));
       plot->setPlotLineWidth(2);
       plot->setInvertOrientation(true);//左右颠倒绘制
       plot->render(plot_result);//根据参数进行渲染

       imshow("The plot rendered with some of custom visualization options", plot_result);
       waitKey();
    return 0;
}

输出结果: