Debugging unmanaged C++ images in Visual Studio - c++

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.
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.

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.

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.

Related

Basic visual studio c++ 2015 help mfc classes?

I'm trying to get started with visual c++ by looking at some open source code and following some tutorials. I'm looking at the code and trying to figure out where parts are that I could modify but it's all just a bunch of confusing mess to me at this point for some very large open source and tutorial programs I'm looking at. I can't find the code that contains information about a specific variable or input for instance that I would like to try to understand better.
One of the things you see in beginner tutorials is that you can bring up the resource visual part of the application. Most tutorials start with drawing out the gui interface. The thing that they do to bring them to the coding area is just double clicking on the element. When I do this with my example source files though it just brings up the MFC add Class wizard, it doesn't take me to the code? I've tried researching what that is and gotten nowhere. Can someone explain to me why it doesn't take me to the relevant code what the mfc class wizard is, and how to find the parts of code that spcifically having to do with the particular input box/slider/dropdown ect easily?
Thanks for any help!

Debugger visualizer of GDI objects for unmanaged C++

Technically, is there a way to show images (bitmaps, icons, cursors) directly inside the watch window? As far as I know there is no way to do that via autoexp.dat. (If not, a tool window will also do.)
How can I transfer the image data from the debuggee to the debugger visualizer?
What other (see below) resources or sample code exists for the problem at hand?
Aside from the MSDN documentation and examples, I found this: http://www.idigitalhouse.com/Blog/?p=83 ... however, it "only" covers textual data. Virtually all other information was superficial (only covering "default" features of autoexp.dat) or for managed code.
Basically I am looking for this, but for unmanaged debuggees. The linked visualizer does not appear to work with unmanaged (C++) code, I tried that.
Is there any solution for native code at all?
I've eventually stumbled upon your question while googling. I had exactly the same question, only for OpenCV, not GDI images. I found there is no simple solution for this task. However, I've implemented one based on Visual Studio Debugging Expression Evaluator Add-In.
My implementation is available as a VSIX package named NativeViewer at SourceForge. If you need, you can adapt it to work with GDI images instead of OpenCV.
Have you seen my FeinViewer? I stopped supporting it for the lack of interest...
http://feinsoftware.com/FeinViewer.php
Aside from the visualizer by Mikhail, there is this one:
http://victorhurdugaci.com/projects/vsimagevisualizer/

Force Visual C++ to generate XML comments solely for my files?

having an issue that I can't seem to find a direct answer to. I'm in the late stages of building a game engine with a few friends and at this point, we're looking to streamline the comments to make them more readable and useful for any developers that may wish to join the team. Since we use Visual Studio 2010, the embedded XML commenting seemed like the perfect tool, and it is! The only issue we are having is that the graphics library our engine is based upon seemed to have the same idea, and also uses XML-like commenting schema. Unfortunately, the syntax of whatever tool they used to compile their XML comments is dissimilar to the one used in Visual Studio so when Visual Studio attempts to render their comments to the projects XML output file, all we get is a huge string of errors that really tie up the process and are completely unneeded anyway since we only want documentation for our code. So, in short, is there some compiler parameter or option I can set in Visual Studio/VC++ that will force it to only generate an XML-comments output file for our classes and documentation? Thank you so much.
Forget Visual Studio and use a real documentation generation tool like doxygen. It handles the MS XML based documentation and you can configure it to only search certain files or directories.
EDIT Doxygen has it's own documentation tag format described here but it also handles JavaDoc style comments. XML style comments are described here.

Display PNG on Visual Studio form

I'm working on a C++ application in Visual Studio (non-MFC) and was surprised to find that I can't add a PNG image to a dialog in the designer which seems a little backward as I can in most other IDEs that I've used. So either a) there is something I'm missing or b) there is a way to do it with code. I'm hoping that it's a but b would be fine.
Any advice suggestions on this?
Thanks,
J
Calling the dialog template editor a "designer" would be rather a stretch. It hasn't changed in the past 15 years or so, neither has the underlying API. An API that doesn't support PNGs, only BMPs. Getting PNG support is possible, GDI+ is available on any Windows version since 2000. But you have to code it yourself.
This is a solved problem, there are excellent class libraries available for UI development, along with tooling to do what you want to do. Qt is one of them if you want to stick with C++.

Internal format of Visual Studio .ncb files

I have decided that I really need to get some flowcharts for reverse engineering some code I have inherited. I do not have the Team edition of VS so I cannot use Team's built-in capabilities with Visio. So I thought I would parse the .ncb (Parser Information) files and make charts with dot (from graphviz.org). How hard could that be? But I cannot find any documentation for the innards of that file.
I really don't want to use a commercial application to do the flowcharts. And the free addins I've seen all assume that I am using C# or VB. However, I am using C and C++.
I did try the Microsoft "Visual Studio Learning Pack" which has the "Visual Programming Flow Chart" tool. But it doesn't appear to work with C++. So close!
So, does anybody have pointers to the file format or other suggestions (keep it polite!)?
I don't think you have much chance to be able to parse the NCB files. They are in a proprietary binary format that changes and is likely to change between every single version of visual studio. From what I read somewhere, it's possible that in VS2010 the NCB is going to be discarded and the intellisense information is going to be kept in normal database using SQL Server Express.
Another option you might consider is using some other tool that analyzes your code and builds diagrams and UML charts. Doxygen does this to some extent and there is a plethora of commercial tools that do as well. I have some personal experience with Rational Rose (which might be defunct by now..) and a tool called Together. This list might be of some help
For a structural analysis in the sense of "who calls what", "who inherits/overloads where" and "who reads/writes globals" I once used DeHydra (a mozilla project) for analysis and yed (www.yworks.com) for graph display. Both are free.
Dehydra runs under linux and requires your code to pass gcc compilation. This is not a too serious obstacle, as VC can generate makefiles, which can be hand-modified for gnu make.
In my case, some patching of include files was required, but i could finally get the desired information out.
It took me 3 days to get DeHydra working, another 2 days to tweak makefile and includes and
3 more days to adapt javascript code, which inside DeHydra extracts the required information.
DeHydra + Javascript now delivers in one compiler run a graphml file containing the code structure, which can directly displayed and interactively manipulated in yed.