imagewatch是一个优秀的查看图片数据的插件,解决了调试opencv程序时查看图片不方便的问题。
我的vs2017版本为15.4,使用Andrei的方法同样安装成功。
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)
在这里,不要自作聪明将15.0改为15.4,否则安装失败。
附上修改后的安装文件,双击打开即可安装成功:
http://download.csdn.net/download/f1121814098/10112641
使用方法:
一直以来,很多时候都是用Matlab来进行图像处理和算法研究,主要是觉得其可以方便的查看图像、像素点等等(本人是菜鸟,如果是高手可以快速用C语言实现的请指导),所以一直以来都是matlab来写算法,不过这样写有个大麻烦就是转化成工程代码还得再次写C/C++,离工程应用总觉得差那么一步。最近刚好看到这个VS2012以后的插件Image Watch可以代替部分matlab里面显示图像信息很方便的功能,很受用。
这位仁兄是发现这个功能比较早的:http://www.cnblogs.com/liu-jun/p/3161654.html
基本功能都介绍的很详细,几个链接如下:插件的下载链接:https://visualstudiogallery.msdn.microsoft.com/e682d542-7ef3-402c-b857-bbfba714f78d
opencv对插件的介绍:http://opencv.org/image-debugger-plug-in-for-visual-studio.html
详细的介绍文档:http://docs.opencv.org/2.4/doc/tutorials/introduction/windows_visual_studio_image_watch/windows_visual_studio_image_watch.html#windows-visual-studio-image-watch
研发团队对该插件的详细介绍:http://research.microsoft.com/en-us/um/redmond/groups/ivm/imagewatchhelp/imagewatchhelp.htm#_Toc351981444
下面以官网上的代码进行简介:
-
// Test application for the Visual Studio Image Watch Debugger extension
-
#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;
-
}
该代码是一个简单的图片读入,然后进行边缘处理的代码,根据该代码,进行图片显示的步骤如下:
1.采用debug模式进行编译,设置一个断点
2.查看debug模式下哪些变量是可见的:Debug ‣ Windows ‣ Locals
3. 查看debug模式下哪些变量是可见的
4.在运行debug模式下,运行到断点处的时候,可以打开image watch插件进行查看:View ‣ Other Windows ‣ Image Watch
这个时候可以清楚的在Image watch窗口里面看到所有的图像Mat,然后点击就可以显示每个图像了,在图像显示区域G进行显示。这个插件做的比较好的就是,可以实时显示鼠标的坐标(H区域)和像素值,还可以通过鼠标滚轮进行放大缩小等,详细的可以参考链接介绍。
至此,基本的类似Matlab显示图像和查看像素值等功能已经完成,除了这个之后,该插件还有一些很厉害的功能,在图片区域点击鼠标右键可以看到这些功能
主要是Link views这个功能比较强大,它可以在原始图像上选择一块区域,然后设置好,再点击后续的mat,就可以看到其他图像在设置区域内的变化,这个很强大!可以实时查看局部区域图像处理的结果。
其他的功能还有缩小和放大等,基本和matlab差不多,可以放大到像素级的,然后通过Link views查看局部的像素值随着算法运行而改变的情况等等。
差不多这些处理步骤在基本的图像算法里面就够用了,基本可以替代matlab的一些图像显示的功能了,当然还有更多的功能,请参见http://research.microsoft.com/en-us/um/redmond/groups/ivm/imagewatchhelp/imagewatchhelp.htm