Debugging unmanaged C++ images in Visual Studio

2020-08-16 11:34发布

I do write lots of image processing code with lots of different images involved on unmanaged C++ under Visual Studio 2010. I want to be able to watch them almost as easily, as a simple identifier while step-by-step debugging.

My current solution is to use some function which exports image in Matlab console. It is ok, but requires modification to source code, while I want to do it just while debugging. So the best option is just image popping up while hovering containing variable by mouse. But writing some command ExportToMatlab(image) in Command Window is enough. I don't know how to do even this, however.

There is the very similar question "Debugging image rendering in Visual C++, any helpful add-ins?", but it is too old and I found no acceptable answers in that discussion. Some tools are .NET-based (see image below), some requires additional code to be written (that's what I currently am using), and some projects are frozen or unfinished.

Screenshot from DebuggerVisualizer

I can spend some time on implementing appropriate solution, so links to some good guides on how to customize debugger visualizer in VS are welcome too.

Update

I've created a Visual Studio extension based on Expression Evaluator Add-In. It is available to download from its SourceForge project page, called NativeViewer. Check for description on how to use it.

2条回答
Anthone
2楼-- · 2020-08-16 12:17

Just for history: I've implemented my own solution based on Expression Evaluator Add-In. It doesn't fit well enough, but I was able to implement all what I needed.

Update

I've created a publicly available Visual Studio extension. It is available to download from its SourceForge project page, called NativeViewer. Check for description on how to use it.

查看更多
Explosion°爆炸
3楼-- · 2020-08-16 12:19

I can't actually believe that nobody suggested Image Watch yet. It's the most amazing add-in ever. It shows you a view with all your Mat variables (images (gray and color), matrices) while debugging, there's useful stuff like zooming or contrast-stretching and you can even apply more complex functions directly in the plugin in real-time. It makes debugging of any kind of image operations a breeze and it's immensely helpful if you do calculations and linear algebra stuff with your cv::Mat matrices.

enter image description here

查看更多
登录 后发表回答