GithubHelp home page GithubHelp logo

semaphore-egg / simply-view-image-for-python-opencv-debugging Goto Github PK

View Code? Open in Web Editor NEW

This project forked from john-guo/simply-view-image-for-python-opencv-debugging

0.0 0.0 0.0 1.64 MB

visual studio code extension simply view the image of the image variables when debugging python with opencv

License: MIT License

TypeScript 83.84% JavaScript 16.16%

simply-view-image-for-python-opencv-debugging's Introduction

simply-view-image-for-python-opencv-debugging README

Features

This simple extension can and only can let you view the image of a variable when you are debugging python codes with opencv.

Currently, It's only support python with opencv module (opencv-python) debugging.

There is a limition that's your python codes must import opencv as cv2 and import numpy as np.

For example:

import cv2
import numpy as np

Requirements

Python debugger extension for vscode (vscode Microsoft official python extension recommend)

Python module of OpenCV support imwrite function installed (official module opencv-python recommend)

How to use

Due to vscode do not allow extension customizes hover when you are debugging so that this extension use the code action command to open a new editor to view the image.

Since 0.0.5 add a command "View Image(Python OpenCV Debug)" and a keybord shortcut "ctrl+alt+q" to open the image.

Step

  1. Open a python file which has "import cv2".

  2. Start Debug

  3. Break on a certain line

  4. Click a variable that contains image data and waiting for the code action icon (a little yellow light bubble) popup.

  5. Click the icon or press ctrl+. to popup a menu then click the menu to view image.

How to use

Extension Settings

No settings, the initail version is hardcode.

Limitations

The initail version is hardcode so there are some limitations:

  1. Only work on python debugging with opencv module.

  2. The python opencv module must support imwrite("filename to save", image_variable) function.

  3. The python file must import opencv module as cv2 such as "import cv2" and import numpy as np such as "import numpy as np";

  4. The extension use imwrite to save the temporary image file.

  5. The temporary directory is hardcode.

  6. The temporary image file type is png.

  7. The temporary image files are removed on extension activation not deactivation.

  8. Unsupport variable tracking while debugging so the image cannot be refreshed automatically. You must click the variable again to refresh.

Release Notes

0.0.9

Support TF2 tensor(Eager Execution must be enabled) or any other object that has a "numpy()" function which can convert it to a numpy array. Thanks to saeedizadi (john-guo#13)

0.0.8

Now the global variables can be view, but still cannot know which thread or stack frame current within so that if many variables with the same name in different threads or different stack frames the result will be confused.

0.0.7

Using a workaround for supporting multithreading. Thanks to zhfkt (john-guo#6)

0.0.6

Add an option "svifpod.usetmppathtosave" to choose which path (tmp or extenion private storage path) to save, default is tmp path.

0.0.5

Add a command "View Image(Python OpenCV Debug)".

Add a keyboard shortcut "ctrl+alt+Q" for quickly image viewing.

0.0.4

Add ndarray checking to avoid some exceptions.

0.0.3

Update README.md

0.0.2

Add support for float np array. Notice it's a hardcode workaround. Because of this fixing the python file must import numpy as np also. Thanks to marisancans (john-guo#1)

0.0.1

Initial release

Enjoy!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.