decode_image.h 977 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. This example code is in the Public Domain (or CC0 licensed, at your option.)
  3. Unless required by applicable law or agreed to in writing, this
  4. software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
  5. CONDITIONS OF ANY KIND, either express or implied.
  6. */
  7. #pragma once
  8. #include <stdint.h>
  9. #include "esp_err.h"
  10. #define IMAGE_W 320
  11. #define IMAGE_H 240
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. /**
  16. * @brief Decode the jpeg ``image.jpg`` embedded into the program file into pixel data.
  17. *
  18. * @param pixels A pointer to a pointer for an array of rows, which themselves are an array of pixels.
  19. * Effectively, you can get the pixel data by doing ``decode_image(&myPixels); pixelval=myPixels[ypos][xpos];``
  20. * @return - ESP_ERR_NOT_SUPPORTED if image is malformed or a progressive jpeg file
  21. * - ESP_ERR_NO_MEM if out of memory
  22. * - ESP_OK on succesful decode
  23. */
  24. esp_err_t decode_image(uint16_t **pixels);
  25. #ifdef __cplusplus
  26. }
  27. #endif