Skip to content

Latest commit

 

History

History
165 lines (99 loc) · 8.58 KB

README.md

File metadata and controls

165 lines (99 loc) · 8.58 KB

Debug Image Viewer (former OpenCV Image Viewer) Plugin

This is a repository for reporting bugs and asking questions related to the Debug Image Viewer (former OpenCV Image Viewer) plugin.

Description

Numpy | OpenCV | Pillow | PyTorch | TensorFlow

The plugin displays an image without stopping the debugger. The basic (free) version allows working on OpenCV Images (ndarray or Mat). The premium version also supports Pillow/PIL images, and Tensorflow and PyTorch tensors. This will enable you to observe the data you are currently working on.

There are three ways to display the image/tensor during debugging:

  • middle-click (middle mouse button);
  • a keyboard shortcut Alt+I (default keymap);
  • an action from the context menu of the variable.

The Debug Image Viewer is a multifunctional tool that displays data in two modes: pop-up and dialog. Change this option in the settings and see which mode is right for you. The plugin allows you to display the variable name, image size, color depth, and data type. In addition to displaying the image, Debug Image Viewer also allows inverting BGR into RGB channels and saving the image in PNG format.

Grayscale, BGR, or BGRA images are supported by default. Also, multichannel arrays can be viewed, for which each channel is displayed separately. You can also apply a colormap to any single channel.

One of the most important plugin options is normalization. That is the procedure that modifies the pixel values' scale. Normalization aims to bring an image to a range that is normal to sense. Normalization is a very useful technique when working with data science since it enables displaying matrices beyond the typical image range.

The displaying behavior:

  • If the array is uint8 or quint8, it is displayed as is;
  • If the array is int8 or qint8, the pixel values are added to 128 ([-128,127] -> [0,255]);
  • If the array is uint16, uint32, uint64 or quint16, the pixel values are divided by 256 ([0,65280] -> [0,255]);
  • If the array is int16, int32, int64, qint16 or qint32, the pixel values are divided by 256 then added to 128 ([-32768,32512] -> [0,255]);
  • If the array is float16, float32, float64 or bloat16, the pixel values are multiplied by 255 ([0,1] -> [0,255]);
  • If the array is boolean, the pixel values are multiplied by 255 ({False,True} -> {0,255}).

To work with Debug Image Viewer, the image must be in HWC or CHW format when you use Python. For the C++ environment, the image must be a contiguous array.

Debug Image Viewer provides a simple and user-friendly interface for displaying images which makes work much easier. The plugin is a tool for developers and researchers working with OpenCV, Pillow/PIL, TensorFlow, or PyTorch, as it provides an efficient and intuitive way to view and analyze image data.

Features

Debug Image Viewer is a graphical user interface (GUI) plugin for JetBrains IDEs that allows users to easily display OpenCV and PIL images, Tensorflow and PyTorch tensors during debugging. Only OpenCV visualization is available in the free version. You can check all the features below.

*Feature not yet available. We are working on the implementation. All available features are listed below.

Free

  • the ability to change the window mode: popup or dialog:
    • light popup disappears when un-clicked;
    • dialog remains visible until you close it; allows you to display (unlike a popup) several images at once;

  • displaying the cursor position and pixel value under the cursor;

  • possibility to copy the image to external programs (e.g., GIMP) and save the image to disk;

  • remembering the position of the last opened picture and opening another one in the same place;

  • remembering the size of the last opened picture and opening another one in the same size;

  • force “view as image” (C++ only) for other types containing Mat e.g. std::shared_ptr

  • startup notifications: contains info about changes in the new version.

Premium

  • channel inversion: from BGR to RGB and RGB to BGR;

  • normalization of the image: stretching the range of values to an interval appropriately defined for the type of the variable;

  • image transposition from HWC to CHW and vice versa;

  • displaying channels separately as single-channel images;

  • applying a pseudo-color to a single-channel image;

  • displaying the pixel value in hexadecimal under the cursor;

Language support

Debug Image Viewer plugin brings full support for the following languages: Python, C++, Java/Kotlin/Android.

Note it may work for other languages, but they are not officially supported or tested for now.

Python - there are several modes in which you can display the image

  • variable type: numpy (ndarray), Pillow/PIL* (Image, ImageFile), PyTorch* (Tensor, Parameter), TensorFlow* (EagerTensor, ResourceVariable)
  • data type: bool, uint8, uint16, uint32, uint64, int8, int16, int32, int64, float16, bfloat16, float32, float64, quint8, quint16, qint8, qint16, qint32
  • number of dimensions:
    • 1D: any
    • 2D: any
    • 3D: any*
    • 4D and more*: any if first dimensions are ones (e.g. 1x1x100x100x3)

*Premium version only

  • debug mode

  • console mode

  • jupyter notebook mode

  • remote interpreter

C++

  • variable type: Mat, Mat*, Mat**, Mat&, Mat&&, const Mat, const Mat*, const Mat&, const Mat&& [1]
  • data type: CV_8U, CV_16U, CV_8S, CV_16S, CV_32S, CV_32F, CV_64F
  • number of dimensions:
    • 3D: any height, any width, 1, 3, or 4 channels

[1] Force View As Image for other types containing Mat available

Java/Kotlin

  • variable type: Mat
  • data type: CV_8U, CV_16U, CV_8S, CV_16S, CV_32S, CV_32F, CV_64F
  • number of dimensions:
    • 2D: any
    • 3D: any height, any width, 1, 3, or 4 channels

Android

  • variable type: Mat
  • data type: CV_8U, CV_16U, CV_8S, CV_16S, CV_32S, CV_32F, CV_64F
  • number of dimensions:
    • 2D: any
    • 3D: any height, any width, 1, 3, or 4 channels

Summary

[1] Force View As Image for other types containing Mat available