OpenCV in Image Watch plug-in installation using tutorial

Source: Internet
Author: User

Original address:

Image Watch (download) is a OPENCV of the latest tool, it can instantly display the contents of the matrix, that is, the memory of the mat information, easy to debug the program, very useful. However, currently the plugin only supports VS2012 and cannot save debug information.

: Click to open link

Installation method:

1 Download the plugin from the above URL and get a imagewatch.vsix after downloading.

2. Open the VS2012 installation directory, Vs2012/commom7/ide/microsoft VSIX Installer.EXE

3 Copy the file, rename it to Vsixinstaller, and put it in the directory above.

4 Double-click the imagewatch.vsix you downloaded from the beginning

The following is the official OPENCV to the image watch list of help documents, took a long time to translate, for everyone's reference.

The following translations are from the official help document of the image watch plugin click the open link

The visual Studio 2012 platform is required, and to ensure the smooth running of the hybrid debug mode, you need to cancel Managed C++compatibili, debugging, Tools-Options Ty Mode

Basic operation:

Start the image watch plugin for the first time: Enter the debug state and select View->otherwindow->image Watch. Note that once this is done, the Image Watch Window automatically pops up during debugging in the future debugging process. and closes after debugging is finished.

Image Watch contains the locals and watch window two windows, with the radio button in the upper right corner to toggle, similar to the Locals and Watch window windows in vs. In locals mode, the window automatically lists the variables of all the picture types in the current stack as pictures, and in watch mode, the window displays the user-specified picture type variables.

Each picture in the list is labeled with a square thumbnail icon for each variable. When the small icon is blue, detailed additional information about the picture variable is displayed in the right window, including the thumbnail of the image, the size of the picture (width and height in pixels), the pixel format (number of channels, and the data type of the pixel), and the specific supported C + + types and pixel data formats are mentioned below.

In the picture browser on the right, you can select one image at a time to browse, and the mouse actions supported by this browse window include left drag and roller skating. The magnification of the current picture is displayed in the upper Corner (F), the current pixel coordinates are displayed at the mouse pointer (G), the current pixel value is displayed at the top of the window, and by rotating the mouse wheel to enlarge the image, when the magnification is higher, the pixel value will be displayed directly on the original.

Imagewatch can automatically load the picture variables in the current debugging process, and we can also browse by right-clicking the variable selection in the Code editing window (J) or the Monitor window (I) to add it to the Image Watch window.

Image list

The design of the image list (Figure1 B) is similar to the design of the box in the VisualStudio list, including the local and watch two modes. In local mode, the elements in this list are read-only and are automatically displayed. In watch mode, you can add new variables by double-clicking the text entry, pressing the F2 key and typing the variable name, and the entry can be cut (ctrl+x, Ctrl+delete), copied (ctrl + C, Ctrl+insert), and pasted (ctrl+v,shift+ Insert) and so on.

Image list can be manipulated with up and down ARROW keys, TAP/CTRL+TAP, and Home/end keys

By clicking the "+/-" in the upper-left corner of each entry in the image list, you can collapse or expand the corresponding thumbnail, and when the entry is collapsed, only the name of the entry is displayed, and the benefit is that you can reduce the update time of the Image Watch window during debugging because all the information displayed in the window Include individual thumbnail icons, which need to be reloaded after each breakpoint is executed or a single-step operation is completed. When there are quite a few items in the image list, the picture is very large, or the debugging process is performed on the remote computer, the folding icon is very effective every time the plugin update time becomes obvious.

2 is shown in the Image List window with a text menu (click) right mouse button activation. The items included in this menu are:

· Expand/collapse all: Expands or collapses all entries in the current list

· Expand New Items: Control window Entry default display state is collapsed or expanded

· Large Thumbnails: Controls the toggle between two thumbnail display sizes

· Auto Maximize Contrast: If not checked, the pixel values will use standard palette rules when mapped to color, and if selected, the current pixel values will be mapped to full color, note that this setting is applicable to all images

1-channel Pseudo Color: If unchecked, the single-channel image will be displayed as a grayscale image, and if selected, the image will be shaded with a pseudo-color palette, which also applies to all images.

4-channel Ignore Alpha: This option is important for quad-channel images. If selected, the last channel of the four-channel image is interpreted as alpha, and if unchecked, the subsequent channel is ignored.

Add to Watch: Adds the selected entry to the Watch Window list.

add address to watch: Adding the addresses of the selected image entries to the Watch window list is very effective when the storage of an image spans a different stack structure.

· Dump to file: Save the currently selected picture as a file, the supported format is PGN, jpg and bin format (image Watch's internal lossless file format), bin file means only for image watch, you can use @file operator to load these files.

Image Browsing Window

The Image Browse window (Figure1, E) displays the currently selected item in a larger size. In this window we can quickly enlarge the image with the mouse wheel to see the values of individual pixels in the image (Figure 1, H).

By holding down the CTRL key while pressing the left mouse button in the Image Browse window, you can quickly switch between the two images before and after browsing.

The display format of the pixels in the window is as follows: X y | C0 C1 ... cN. The channel values are displayed in the order in which they appear in memory.

Right-clicking will pop up the shortcut menu in the window (Figure 3):

· Zoom to fit: automatically sets the zoom ratio to fit the current window display

· Zoom to Original Size: Sets the zoom scale to 1.0, which is a pixel in the picture that corresponds to a pixel on the display.

· Link views: If selected, all images with the same size will be displayed at the same scale as the corresponding position. For example, after zooming in on an area of a 1024x768 image and selecting another image with the same size in the image list, the browser will display the magnifying effect of the same area of the second image, but if you select a 640*480 picture, you will see a different area , that is, this picture is displayed according to all 640*480 's picture specifications.

· Auto maximize Contrast/1-channel Pseudocolor/4-channel use Alpha: This is the mirror menu for the corresponding part of the shortcut menu in the image list, with the same functionality as the previous shortcut menu. Here the settings for these options are also used with all images.

· Hexadecimal Display: This option will trigger the "Hexadecimaldisplay" setting in Visual Studio, which takes effect when initializing the build Image Watch window. This option in image watch will determine what kind of binary the pixel values will be displayed in.

· Copy Pixel Address: Copies the current pixel values in memory to the Clipboard, which is useful for logging. The addresses that can be addressed are pasted into the memory debugger in VS, or used to generate a data breakpoint.

Image format

Image Watch supports the following C + + graphic formats


· Cv::mat_<>

· Cv::mat

· Cvmat

· _iplimage

User-defined image formats can be added using the extensibility interface described below.

Pixel format

The pixel format in image Watch mainly includes the channel type and the format of each channel

Image watch supports the following data types primarily


· INT16, UINT16

· INT32




The channel format represents the number of channels with a maximum of 512 channels.

It should be noted that the arrangement of strings is related to the format of the pixels, and each channel is sorted in the following semantic order:

· RG, UV



If you do not explicitly specify the order of the channel semantics (for example, all OPENCV types), image watch uses the default palette rules to classify the images.

At the same time, image Watch has a certain number of YUV formats. In this case, the order in which the channel semantics are arranged determines how the data is arranged,

· NV12 (Two scenarios: one is the y plane, one is the packaged UV plane, that is, the second sampling on two dimensions)

· YV12 (three scenarios, one is the y plane, one is the packaged U-plane and V-plane, the second sampling is performed on two dimensions)

· IYUV (same as YV12 method but flat order swap of U and V)

· YUY2 (single scenario, each row of two channels scanned, Y is the first channel, the U and V channels are horizontally oriented secondary sampling and stored in the second channel

For more information about YUV format, please refer to

Color mapping mode

The following two rules are used to map colors in image watch:

The first depends on the corresponding color space. If the corresponding semantic order defaults, the corresponding color space is determined based on the number of channels:

· 1 channel Image: Determines the use of grayscale or pseudo-color plots based on the settings in the current browser window

· 2 channel Image: Red or green

· 3 Channel Image: Blue green red Three colors

· 4 channel Image: Blue green red and alpha, or ignore alpha channel, related to current settings

· 5 or more channels: First use B, G, R, scheme ignores other channels at the same time

Image operators

Image Watch provides a number of simple operators for a more image view of the data. To differentiate themselves from the inherent C + + statements, the names of these operators begin with "@".

All operators are used to evaluate the image. For example, the @band operator is used to extract a single-channel image from an image. It has two parameters, one is the image name and the other is the number representation of the channel that needs to be extracted.

The operators can be nested between the two. An image entered as an operator can be in any form, that is, the output of another operator can be used as input to another operator. For example, the @thresh operator can perform a binary operation on an image and return a binary image, and Figure 4 (L) shows how to use 120 as a threshold to two value the green channel in an image.

Note: In the absence of other instructions, the Imagewatch operator's run algorithm is Float32 bit, and return the Float32 image results, which means that INT32 image after the operation will lose some precision, FLOAT64 image after the operation will not lose precision, And the error will increase.

Note: By default, FLOAT32 will map the color of the image according to the following rules: The pixel value of 0% intensity is mapped to 0.0f, the pixel value of 100% intensity is 1,0f, and the excess part will be omitted directly. For example, if @clamp restricts a UINT8 image to between 10 and 20, the resulting image will be all white, since all pixel values are in the range of 10 to 20 and are directly mapped to 1.0f. So when we use the image watch operator, we need to make sure that automatic contrast maximization is selected. Coincidentally, the following @norm8 and @norm16 operators will be described in addition to the results of 255 and 65535 of the processing, but also a data type conversion.

List of image Watch operators:

· @band (IMG, number): extracts the corresponding values in the image according to the channel count specified by numbers, noting that this operator requires specifying the corresponding channel markings that need to be extracted.

· @thresh (IMG, threshold): Binary image processing, the value is greater than the threshold value of 1, when the threshold is less than the value of the pixel is assigned to 0.

· @clamp (img, MIN, max): truncates the image's pixel values with the given minimum and maximum values.

· @abs (IMG): Calculates the absolute value of pixels in an image

· @scale (IMG, factor): Multiplies the pixel values of all pixels in the image by the scale factor factor

· @norm8 (IMG): Multiplies the pixel value of an image by 1/255

· @norm16 (IMG): Multiplies the pixel value of an image by 1/65535

· @fliph (IMG), @flipv (IMG), @flipd (IMG): Flips the image symmetrically in the horizontal, vertical, and diagonal directions

· @rot90 (IMG), @rot180 (IMG), @rot270 (IMG): Rotate the image clockwise 90 degrees, 180 degrees, and 270 degrees

· @diff (Img0, IMG1): Do the following on a point-by-dot basis img0–img1

· @file (PATH): Loads the picture from the specified path. Example: @file ("D:\temp\debug.png")

·   @mem (address, type, channels, width, height, stride): Declares a piece of memory based on the given start address, channel type, number of channels, width, height, and amplitude, such as example: @mem (, UINT8, 1, 320, 240, 320)

Figure1 Click to open link

Figure4 Click to open link

Interested in Welcome everyone add group 517,018,531 discussion.

(go) OpenCV in the image Watch plugin installation using tutorial

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.