VS2019使用ImageWatch调试OpenCV

1、ImageWatch2019的安装

打开VS2019,点击扩展->管理扩展->联机->右上角搜索ImageWatch,然后根据提示进行安装。

2、ImageWatch的使用

新建一个项目,将下列代码拷贝进去。

// Test application for the Visual Studio Image Watch Debugger extension
#include <iostream>                        // std::cout
#include <opencv2/core/core.hpp>           // cv::Mat
#include <opencv2/imgcodecs/imgcodecs.hpp>     // cv::imread()
#include <opencv2/imgproc/imgproc.hpp>     // cv::Canny()
using namespace std;
using namespace cv;
void help()
{
    cout
        << "----------------------------------------------------" << endl
        << "This is a test program for the Image Watch Debugger " << endl
        << "plug-in for Visual Studio. The program loads an     " << endl
        << "image from a file and runs the Canny edge detector. " << endl
        << "No output is displayed or written to disk."
        << endl
        << "Usage:"                                               << endl
        << "image-watch-demo inputimage"                          << endl
        << "----------------------------------------------------" << endl
        << endl;
}
int main(int argc, char *argv[])
{
    help();
    if (argc != 2)
    {
        cout << "Wrong number of parameters" << endl;
        return -1;
    }
    cout << "Loading input image: " << argv[1] << endl;
    Mat input;
    input = imread(argv[1], IMREAD_COLOR);
    cout << "Detecting edges in input image" << endl;
    Mat edges;
    Canny(input, edges, 10, 100);
    return 0;
}

然后在Mat input处设置断点,进入调试模式,然后选择视图->其他窗口->ImageWatch,即可。如下图所示。
在这里插入图片描述

3、常用功能

  • 滚轮缩放
  • 右键->LinkView:固定选定区域
  • 在local中右键添加到Watch,监视图片。
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值