本文最后更新于:2023年12月5日 下午

Visual Studio C++ 开发 OpenCV 程序时经常需要对图像进行可视化,本文记录 VS 编写 OpenCV 代码时可视化插件 ImageWatch 的安装和使用方法。

简介

  • Image Watch 是一个监视窗口,用于在调试本机 C + + 代码时查看内存中的位图。
  • 当前版本(发行说明)内置支持 OpenCV 映像类型(cv::Matcv::Mat_<>CvMat_IplImage)。
  • 环境需求: 建议使用 Visual Studio 2012 Update3 (最低要求为 Update1)

下载安装

使用方法

  • VS 配置好 OpenCV 环境 后正常编写 OpenCV 开发的代码

  • 在调试过程中使用插件查看图像数据

  • 中断调试器并选择: View -> Other Windows -> Image Watch / 视图 -> 其他窗口 -> Image Watch

  • 或者,单击“本地化”窗口中图像变量旁边的放大镜图标或调试器数据提示。

使用示例

  • OpenCV 读取图像示例:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include<stdio.h>
#include<opencv2/opencv.hpp>
using namespace std;
using namespace cv;


int main()
{
printf("Hello Open CV!");
Mat srcImage = imread("test.jpg");
Mat temImage, dstImage1;
temImage = srcImage;

return 0;
}
  • 加入断点,开启 Image Watch

  • 可以看到可视化图像,每个像素点的 RGB 通道数值和位置,分为 Locals 和 Watch 两栏用于观察变量

参考资料



文章链接:
https://www.zywvvd.com/notes/coding/cpp/opencv-image-watch/opencv-image-watch/


“觉得不错的话,给点打赏吧 ୧(๑•̀⌄•́๑)૭”

微信二维码

微信支付

支付宝二维码

支付宝支付

OpenCV image watch 插件安装与使用
https://www.zywvvd.com/notes/coding/cpp/opencv-image-watch/opencv-image-watch/
作者
Yiwei Zhang
发布于
2022年10月27日
许可协议