Image Watch is a plug-in for Microsoft Visual Studio that lets you to visualize in-memory images (cv::Mat or IplImage_ objects, for example) while debugging an application. This can be helpful for tracking down bugs, or for simply understanding what a given piece of code is doing.
总的来说Image Watch 就是一个debug时候对于图像的观察的窗口。
stepone:
1.download the Image Watch Installer for visual studio 2019,安装程序是一个单文件,文件的后缀名是.vsix。
The introduction of Image Watch Installer
Image Watch is a watch window for viewing in-memory bitmaps when debugging native C++ code.
The current version has built-in support for OpenCV image types (cv::Mat, cv::Mat_<>, CvMat, _IplImage). To enable user-defined image types please refer to the Image Watch documentation.
This version works with Visual Studio 2019.
Quick Start: Simply break in the debugger and select View > Other Windows > Image Watch. Alternatively, click on the magnifying glass icon next to an image variable in your Locals window or on the debugger Data Tip.

==2double click on the .vsix file ==



3.when the installer has finished, make sure to restart Visual Studio to complete the installation.
关闭visual studio, 安装完成后重新打开visual studio

打开View Install Log,可以看到拓展程序的安装位置, 已成功完成到 Visual Studio Community 2019 的安装。扩展已经安装到 C:\USERS\ADMINISTRATOR\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\16.0_823E3688\EXTENSIONS\JQWAAQUV.YU4\
steptwo:
新建一个项目进行测试,window控制台项目


stepthree:
1.对项目进行property sheet opencv的设置,参考,是对debug进行设置
2复制下面的代码:(这个程序中并设置窗口去显示图像,以此来测试这个ImageWatch )因为是built-in
/ 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;
}
3对活动解决方案进行设置:


4.因为程序中有char*argv[],所以要对add the command line argument of your input image to your project,,这个是这个程序的自己的独特之处而已




5.查看本地局部变量 Debug->Windows->Locals,就会出现上面的图那样
Note that the built-in Local window will display text only.
6.如果想要查看built-in 的图像形式, View->Other Windows->Image Watch
**Note that Image Watch is like Visual studio’s Local window. **
Visual Studio will remember whether you had Image Watch open, and where it was located between debugging sessions.
This means that you only have to do this once-the next time you start debugging, Image Watch will be back where you left.



Image Watch是一款用于Visual Studio 2019的插件,可在调试C++应用时可视化内存中的图像。本文介绍了如何下载和安装Image Watch,以及如何在调试过程中利用它来观察和理解代码对图像的操作。步骤包括安装插件、设置项目以支持OpenCV图像,并在调试时通过Local窗口和Image Watch查看图像。
230

被折叠的 条评论
为什么被折叠?



