-
Notifications
You must be signed in to change notification settings - Fork 334
[VSC-1608] Feature/debug image viewer #1644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Download the artifacts for this pull request: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! LGTM
Pull request has been marked as |
6cada20
to
285983e
Compare
Description
This pull request introduces a new Image Viewer feature to the ESP-IDF extension, enabling users to visualize binary image data from debug variables during a debugging session. The feature supports LVGL, OpenCV, and raw pixel formats, and is accessible both via context menu and command palette. The implementation includes new commands, UI integration, and documentation in both English and Chinese.
Image Viewer Feature Integration
espIdf.viewVariableAsImage
andespIdf.openImageViewer
topackage.json
and registered them in the extension activation code, enabling users to view variables as images and open the image viewer manually. [1] [2] [3]src/views/image-view/main.ts
and included it in the webpack build configuration. [1] [2]Documentation Updates
docs_espressif/en/debugproject.rst
) and Chinese (docs_espressif/zh_CN/debugproject.rst
), including usage instructions, supported formats, and examples. [1] [2]Codebase Structure
ImageViewPanel
in the extension code to handle the new image viewer functionality.These changes collectively provide a user-friendly way to inspect image data in ESP-IDF projects during debugging, supporting a wide range of formats and improving developer productivity.
Type of change
Steps to test this pull request
Using a variable name and size (any decoded image with given size, can use size variable name)
You need a project where you have converted an image into a decompressed byte array and use it in memory.
You can use these steps to convert a jpg into a c file that can be used in an example project. Replace magick and xxd for the equivalent command in your OS. (These I used in MacOS, magick needed to be installed with brew)
magick image.jpg -resize 320x240 -depth 8 -colorspace RGB -channel BGR -separate +channel -combine image.rgb xxd -i image.rgb > main/small_image.h
This steps generate a width 320 and height 240 using BGR888 format image you can use in your project.
For the ESP-IDF project, you can test:
Set a breakpoint after
local_image_len
. uselocal_image_data
as variable name,local_image_len
320 for width, 240 for height and RGB888 for format inESP-IDF: Open Image Viewer
.Load Image
button.Using LVGL
Use the ESP-BSP display example. To me was simple enough to test on different boards. Configure the project Compile Options to Debug without Optimization
-O0
.After Line 82 of lvgl_demo_ui.c file add these lines to get the variable as local:
lv_obj_center(img_logo);
.esp_logo_local
and press View Variable as ImageUsing OpenCV
I've made a test project here.
cv::Mat opencv_image
.opencv_image
and press View Variable as ImageUsing Libpng (custom image viewer variable format)
I've made a test project here. The project includes an example implementation of custom types for Image Viewer as json file: https://github.com/brianignacio5/libpng_example/blob/main/image_configs.json where you can define which variables represent fields need for image rendering. For libpng, the image data pointer and size is not stored in the
png_image
field but in other fields which are defined in this json file.png_image_finish_read
.image
and select View Variable as Image.Expected behaviour:
The image can be rendered from debug session variable into the Image Viewer web view.
Expected output:
Image is rendered in Image Viewer web view.
How has this been tested?
Manual testing following the steps above.
Test Configuration:
Checklist