【VS插件】Image Watch插件

晚上看他们在群里唠嗑,发现了一款神奇的工具,学opencv完全离不开它啊~

工具的名字叫Image Watch是一个VS插件,能够让你在调试一个OpenCV程序的时候,看到内存中的图像,这对跟踪bug或者理解一段代码非常有帮助。

它可以支持vs2012、vs2013及vs2015。其操作步骤为:


1.        从https://visualstudiogallery.msdn.microsoft.com/e682d542-7ef3-402c-b857-bbfba714f78d下载最新版本Image Watch(ImageWatch.vsix);

2.        安装ImageWatch,双击ImageWatch.vsix进行安装即可;

3.        打开一个OpenCV工程,在Debug下设置断点,通过view -> other windows -> Image Watch打开Image Watch窗口,即可显示cv::Mat图像。

Image Watch可进行的操作包括:

1.      放大、缩小图像;

2.      将图像保存到指定的目录;

3.      显示图像大小、通道数;

4.      拖拽图像;

5.      可以查看指定坐标的像素值(按照在内存中的顺序显示);

6.      Link Views:所有相同尺寸的图像共享一个视图;

7.      像素值以十六进制显示还是十进制显示;

8.      在Watch窗口可对图像进行的操作包括(Image Watch包括Locals和Watch两个窗口):

(1)、提取指定通道图像:@band(img, number);

(2)、对指定图像进行阈值化:@thresh(img, threshold);

(3)、对图像像素值进行取绝对值操作:@abs(img);

(4)、对图像像素值进行缩放操作:@scale(img, factor);

(5)、通过1/255方式缩放像素值操作:@norm8(img);

(6)、沿y轴水平flip:@fliph(img);

(7)、沿x轴垂直flip:@flipv(img);

(8)、对图像进行矩阵转置操作:@flipd(img);

(9)、对图像进行顺时针90、180、270度操作:@rot90(img)、@rot180(img)、@rot270(img);

(10)、计算两幅图像的像素差值:@diff(img0, img1);

(11)、载入图像:@file(path),如 @file(“d:\1.jpg”);

(12)、将指定的内存地址内容按照指定的图像格式显示出来:@mem(address, type, channels, width, height, stride),如@mem(0x00000000003d1050,UINT8, 3, 256, 256, 768 );

Image Watch的更详细介绍可参考:http://research.microsoft.com/en-us/um/redmond/groups/ivm/imagewatchhelp/imagewatchhelp.htm


非常简单的一个程序,对一幅图片进行直方图均衡化: 

F5进入调式模式,选择菜单View->Other Windows->Image Watch,就会出现下面的调式界面。

这里写图片描述
注意:不能在Release版本下调试,是显示不出图像的

这里写图片描述

Image Watch左上角有两个单选按钮Locals和Watch,分别对应两种模式 :Locals模式和Watch模式,与VS内置的Locals模式和Watch模式一样 
Locals模式显示当前栈中所有的与变量,Watch模式显示用户手动添加的变量

当程序执行到最后一句的时候,看一下Image Watch窗口 
这里写图片描述

srcImage和dstImage都显示出来了,鼠标单击左边的图像列表,就会在右边的窗口处显示大图。 
当鼠标在右边图像上移动的时候,图像的上面,会显示鼠标所在的位置和该点的像素值。 
这里写图片描述

下面切换到Watch模式: 
这里写图片描述

手动添加变量,如添加一个dstImage变量,显示如下 
这里写图片描述 

对VS2017支持的方法:

For Visual Studio 2017 "support": 

1. Download the extension (ImageWatch.vsix) and open it using WinRAR

2. From inside the bundle, open "extension.vsixmanifest" (using Notepad/Visual Studio, or any XML editor)

3. Edit line number 11 to match: "<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[15.0]" />"

4. Edit line number 15 to match: "<Dependency Id="Microsoft.VisualStudio.MPF.15.0" DisplayName="Visual Studio MPF 15.0" Version="[15.0]" />"

5. Save the file and update it in the archive (select Yes in WinRAR dialog)

6. Install the extension (it will complain that it might not be compatible, but it works)


转自:

http://blog.csdn.net/fengbingchun/article/details/46756373

http://www.cnblogs.com/liu-jun/p/3161654.html


2017/6/21补充

代码对齐线插件

https://marketplace.visualstudio.com/items?itemName=SteveDowerMSFT.IndentGuides

对于VS2012 

http://indentguide.codeplex.com/releases/view/110312


Visual Studio 2012 Color Theme Editor

https://marketplace.visualstudio.com/items?itemName=MatthewJohnsonMSFT.VisualStudio2012ColorThemeEditor