【OpenCV】Image Watch插件

版权声明:本文为博主原创文章,转载请注明出处。 https://blog.csdn.net/Da_Yuan8421/article/details/62417578

下载

Image Watch
如果官网下载有问题,可以戳这里
下载以后双击安装,最好关闭当前打开的VS。
目前支持VS2012,2013,2015
(相信在广大码农的呼吁下很快也会支持2017的)

软件平台

Visual Studio 2015
OpenCV 3.2

使用

官方给的一个例子,需要配置OpenCV

// Test application for the Visual Studio Image Watch Debugger extension

#include "stdafx.h"  
#include <iostream>                        // std::cout
#include <opencv2/core/core.hpp>           // cv::Mat
#include <opencv2/highgui/highgui.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], CV_LOAD_IMAGE_COLOR);

    cout << "Detecting edges in input image" << endl;
    Mat edges;
    Canny(input, edges, 10, 100);

    return 0;
}

添加命令行参数

项目→属性
pic1
调试→命令参数→填图片地址
pic2

加断点Debug

我的断点打在这里
pic3
debug后,如果没有出现变量窗口:调试→窗口→局部变量
pic4
选择想要查看的变量
pic5
image watch窗口
pic6

据说还可以查看.mat文件,有待挖掘。

参考

Image Watch: viewing in-memory images in the Visual Studio debugger

猜你喜欢

转载自blog.csdn.net/Da_Yuan8421/article/details/62417578
今日推荐