AForge.NET Debugging Visualizers
Although AForge.NET Framework provides quite handy IPPrototyper
tool, it still can not be used in all cases when computer vision algorithms need to be debugged. There always will
be a case when application may crash during development, require stopping at break points, stepping through the code
and investigating state of some variables. When it gets to debugging, VS.NET of course provides means for checking
state of different variables. However analyzing state of objects like images using a "Watch" window may not be of
great help when it comes to checking images' pixel data. Imagine yourself checking 65536 pixels' value for a 256x256
image, or even few megabytes for larger images! Does it help a lot? Not sure. Instead you may want to save the image
using "Immediate" window (or do it from your code) and then just visualize it. And it is not only about images - there
are plenty of other objects which you may prefer "to see", instead of analyzing values one by one.
Starting from version 2005, VS.NET introduces such concept as
debugging visualizers:
"Visualizers are components of the Visual Studio debugger user interface. A visualizer creates a dialog box or
another interface to display a variable or object in a manner that is appropriate to its data type. For example,
an HTML visualizer interprets an HTML string and displays the result as it would appear in a browser window; a
bitmap visualizer interprets a bitmap structure and displays the graphic it represents."
Starting from version 2.2.2, AForge.NET framework introduces few visualizer components for some classes, which
are used quite a lot when debugging image processing and computer vision algorithms. At this point there are visualizers
for the next list of classes:
- System.Drawing.Image;
- System.Drawing.Imaging.BitmapData;
- AForge.Imaging.UnmanagedImage;
- AForge.Math.Histogram.
For all objects which have visualizers for them, VS.NET shows a magnifying glass' icon next to their value in
"Watch" window. Same is shown when you mouse over on a variable in source code:
Clicking the magnifying class opens a visualizing component which is associated with the corresponding data type.
Visualizer for images:
Histogram visualizer:
AForge.NET framework's debugging visualizing components are available as part of framework's installation
package. Also these components can be downloaded separately. Just unzip the archive and put corresponding
visualizing components (together with additional AForge.NET components) into the next VS.NET folder (or similar
- depends on installation path):
C:\Program Files\Microsoft Visual Studio <version>\Common7\Packages\Debugger\Visualizers
That is it. Now when you pause your application, you will be able to visualize objects of the above mentioned classes.
|