OpencV图像几何形状绘制

cpp 复制代码
  QString appPath = QCoreApplication::applicationDirPath();
  imagePath = appPath + "/A.jpg";
  img = cv::imread(imagePath.toStdString());
  if (img.empty())
    return;

  Mat bg = Mat::zeros(img.size(),img.type());

  Rect rect;
  rect.x = 200;
  rect.y = 200;
  rect.width = 100;
  rect.height = 50;
  rectangle(bg, rect, Scalar(0, 0, 255), -1,8,0);
  circle(bg, Point(50, 100), 15, Scalar(255, 0, 0), 2);
  line(bg, Point(100, 100), Point(100, 200), Scalar(0, 255, 0), 2, LINE_AA, 0);
  RotatedRect rrt(Point(200, 200),Size(100, 200), 90.0);
  ellipse(bg, rrt, Scalar(0, 255, 255), 2, 8);

  Mat dst;
  addWeighted(img, 0.7,bg,0.3,0, dst);
  imshow("Draw", dst);

推荐一个零声学院项目课,个人觉得老师讲得不错,分享给大家:
零声白金学习卡(含基础架构/高性能存储/golang云原生/音视频/Linux内核)
https://xxetb.xet.tech/s/3Zqhgt

相关推荐
人工智能培训10 分钟前
具身智能视觉、触觉、力觉、听觉等信息如何实时对齐与融合?
人工智能·深度学习·大模型·transformer·企业数字化转型·具身智能
wenzhangli710 分钟前
能力中心 (Agent SkillCenter):开启AI技能管理新时代
人工智能
2301_7634724623 分钟前
C++20概念(Concepts)入门指南
开发语言·c++·算法
阿猿收手吧!39 分钟前
【C++】std::promise原理与实战解析
c++
后端小肥肠1 小时前
别再盲目抽卡了!Seedance 2.0 成本太高?教你用 Claude Code 100% 出片
人工智能·aigc·agent
每日新鲜事1 小时前
热销复盘:招商林屿缦岛203套售罄背后的客户逻辑分析
大数据·人工智能
Coder_Boy_1 小时前
基于SpringAI的在线考试系统-考试系统开发流程案例
java·数据库·人工智能·spring boot·后端
挖坑的张师傅1 小时前
对 AI Native 架构的一些思考
人工智能
m0_706653231 小时前
分布式系统安全通信
开发语言·c++·算法
Zach_yuan1 小时前
深入浅出 JSONCpp
linux·服务器·网络·c++