You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs_espressif/en/debugproject.rst
+97-18Lines changed: 97 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -351,8 +351,8 @@ The ESP-IDF extension provides an **ESP-IDF: Image Viewer** feature that allows
351
351
**Quick Access Methods:**
352
352
353
353
1. **Right-click on variables in the debug session:**
354
-
- Right-click on any ``lv_image_dsc_t`` variable and select ``View as LVGL Image``
355
-
- Right-click on any ``cv::Mat`` variable and select ``View as OpenCV Image``
354
+
- Right-click on any image-related variable (``lv_image_dsc_t``, ``cv::Mat``, ``png_image``, etc.) and select ``View Variable as Image``
355
+
- The Image Viewer automatically detects the variable type and extracts the appropriate image properties
356
356
357
357
2. **Manual Image Viewer:**
358
358
- Go to ``View`` > ``Command Palette`` and enter ``ESP-IDF: Open Image Viewer``
@@ -362,24 +362,28 @@ The ESP-IDF extension provides an **ESP-IDF: Image Viewer** feature that allows
362
362
363
363
**Supported Image Formats:**
364
364
365
-
**LVGL Color Formats (lv_color_format_t):**
365
+
The Image Viewer supports a comprehensive range of image formats:
366
+
367
+
**RGB Formats:**
366
368
- RGB565, RGB888, RGBA8888, ARGB8888, XRGB8888
367
369
- BGR888, BGRA8888, ABGR8888, XBGR8888
368
370
- RGB332, RGB444, RGB555, RGB666, RGB777
369
-
- Grayscale, YUV420, YUV422, YUV444
370
-
- And many more LVGL-specific formats
371
-
372
-
**OpenCV Mat Formats:**
373
-
- BGR888 (3 channels)
374
-
- BGRA8888 (4 channels)
375
-
- Grayscale (1 channel)
371
+
- RGB101010, RGB121212, RGB161616
376
372
377
-
**Raw Pixel Formats:**
378
-
- RGB565 (16-bit per pixel)
379
-
- RGB888 (24-bit per pixel)
373
+
**Other Formats:**
380
374
- Grayscale (8-bit per pixel)
381
375
- YUV420, YUV422, YUV444 (various YUV formats)
382
376
377
+
**Built-in Support:**
378
+
379
+
**LVGL Image Descriptor (lv_image_dsc_t):**
380
+
- Automatically extracts format, dimensions, and data from LVGL structures
381
+
- Supports all LVGL color formats with automatic mapping to display formats
382
+
383
+
**OpenCV Mat (cv::Mat):**
384
+
- Automatically extracts dimensions, format, and data from OpenCV Mat objects
385
+
- Supports BGR888, BGRA8888, and Grayscale formats
386
+
383
387
**Example Usage:**
384
388
385
389
**LVGL Image Example:**
@@ -397,7 +401,7 @@ The ESP-IDF extension provides an **ESP-IDF: Image Viewer** feature that allows
397
401
.data = image_data // Pointer to image data
398
402
};
399
403
400
-
During debugging, right-click on ``my_image`` and select ``View as LVGL Image``. The Image Viewer will automatically extract the format, dimensions, and data from the LVGL structure.
404
+
During debugging, right-click on ``my_image`` and select ``View Variable as Image``. The Image Viewer will automatically detect it as an LVGL image and extract the format, dimensions, and data.
401
405
402
406
**OpenCV Mat Example:**
403
407
@@ -406,7 +410,7 @@ During debugging, right-click on ``my_image`` and select ``View as LVGL Image``.
During debugging, right-click on ``image`` and select ``View as OpenCV Image``. The Image Viewer will automatically extract the dimensions, format, and data from the OpenCV Mat structure.
413
+
During debugging, right-click on ``image`` and select ``View Variable as Image``. The Image Viewer will automatically detect it as an OpenCV Mat and extract the dimensions, format, and data.
410
414
411
415
**Manual Raw Data Example:**
412
416
@@ -421,15 +425,90 @@ For manual usage:
421
425
- Select ``RGB888`` format
422
426
- Set width to ``320`` and height to ``240``
423
427
428
+
**Custom Image Format Configuration:**
429
+
430
+
You can extend the Image Viewer to support custom image formats by creating a JSON configuration file and setting the ``idf.imageViewerConfigs`` configuration option.
431
+
432
+
**Example Custom Configuration:**
433
+
434
+
.. code-block:: JSON
435
+
436
+
[
437
+
{
438
+
"name": "Custom Image Structure",
439
+
"typePattern": "my_image_t",
440
+
"width": {
441
+
"type": "string",
442
+
"isChild": true,
443
+
"value": "w"
444
+
},
445
+
"height": {
446
+
"type": "string",
447
+
"isChild": true,
448
+
"value": "h"
449
+
},
450
+
"format": {
451
+
"type": "number",
452
+
"isChild": false,
453
+
"value": "0x0E"
454
+
},
455
+
"dataAddress": {
456
+
"type": "string",
457
+
"isChild": true,
458
+
"value": "pixels"
459
+
},
460
+
"dataSize": {
461
+
"type": "formula",
462
+
"isChild": false,
463
+
"value": "$var.w * $var.h * 3"
464
+
},
465
+
"imageFormats": {
466
+
"14": "rgb888",
467
+
"15": "rgba8888"
468
+
}
469
+
}
470
+
]
471
+
472
+
**Configuration Options:**
473
+
474
+
- **typePattern**: Regex pattern to match the GDB type of the selected variable when right-clicking "View Variable as Image" (e.g., ``"my_image_t"``, ``"lv_image_dsc_t"``, ``"cv::Mat|Mat"``)
475
+
- **width/height**: Configuration for extracting image dimensions
476
+
- **format**: Configuration for extracting image format
477
+
- **dataAddress**: Configuration for extracting image data pointer
478
+
- **dataSize**: Configuration for calculating image data size (supports formulas)
479
+
- **imageFormats**: Mapping of numeric format values to display format strings
480
+
481
+
**Field Configuration Details:**
482
+
483
+
Each field (width, height, format, dataAddress, dataSize) has the following properties:
484
+
485
+
- **type**: Specifies the data type of the field value:
486
+
- ``"string"``: The value is a string (field name or expression)
487
+
- ``"number"``: The value is a numeric constant (e.g., ``"0x0E"``, ``"14"``)
488
+
- ``"formula"``: The value is a mathematical formula (only for dataSize field)
489
+
490
+
- **isChild**: Determines how the field value is interpreted:
491
+
- ``true``: The value represents a child field of the right-clicked variable (e.g., ``"header.w"``, ``"data"``)
492
+
- ``false``: The value is a direct expression or constant that can be evaluated by GDB
493
+
494
+
- **value**: The actual field name, expression, or constant to use for extraction
495
+
496
+
**Important Configuration Notes:**
497
+
498
+
- **dataSize Formula**: When using formulas in the ``dataSize`` field, the string ``$var`` will be automatically replaced with the actual variable name when you right-click and select "View Variable as Image". For example, if your variable is named ``my_image`` and the formula is ``$var.w * $var.h * 3``, it will be evaluated as ``my_image.w * my_image.h * 3``. **Note**: The formula must be a valid GDB expression since it is calculated by GDB itself.
499
+
500
+
- **Format Number Mapping**: The numeric keys in the ``imageFormats`` object must match the actual numeric values that the ``format`` field extracts from your image structure. For example, if your image structure's format field contains the value ``14``, then the ``imageFormats`` object should have a key ``"14"`` that maps to the appropriate display format string like ``"rgb888"``.
501
+
424
502
**Important Notes:**
425
-
- **LVGL Support**: Automatically extracts image properties from ``lv_image_dsc_t`` structures
426
-
- **OpenCV Support**: Automatically extracts image properties from ``cv::Mat`` objects
427
-
- **Format Detection**: The Image Viewer automatically detects and maps LVGL and OpenCV formats to the appropriate display format
503
+
- **Automatic Detection**: The Image Viewer automatically detects supported image types and extracts properties
504
+
- **Unified Interface**: Single ``View Variable as Image`` command works for all supported formats
505
+
- **Format Validation**: All formats are validated against supported display formats
428
506
- **Raw Data**: The Image Viewer supports raw pixel formats. Compressed formats (JPEG, PNG, etc.) are not supported
429
507
- **Size Specification**: For manual usage, you must specify the correct size of the image data array
430
508
- **Variable Size**: The size can be provided as a number (bytes) or as the name of another variable containing the size
431
509
- **Pointer Variables**: For pointer variables, make sure to provide the actual data size, not the pointer size
432
510
- **Auto-Dimensioning**: The Image Viewer automatically estimates dimensions based on the data size and selected format, but you can manually adjust them for better results
511
+
- **Extensible**: Custom image formats can be added through configuration files
0 commit comments