espressif / esp-dl

Espressif deep-learning library for AIoT applications
MIT License
549 stars 118 forks source link

In-place crop_and_resize (AIV-650) #137

Closed eloquentarduino closed 1 year ago

eloquentarduino commented 1 year ago

I see crop_and_resize can be used to both crop and resize an image. I want to use it to resize in-place a rgb565 frame from my camera. This is what I'd like to achieve:

crop_and_resize(
  dst_image=rgb565,
  dst_width=100, 
  dst_channel=3, 
  dst_y_start=0,
  dst_y_end=0,
  dst_x_start=0,
  dst_x_end=0,
  src_image=rgb565,
  src_height=480,
  src_width=640,
  src_channel=3,
  src_y_start=0,
  src_y_end=480,
  src_x_start=(640 - 480) / 2,
  src_x_end=(640 - 480) / 2 + 480
 )

Will this work? I want to avoid allocating a new array of size 100x100 to store the resized image.

Sandra-lol commented 1 year ago

Hi, looks like it won't work, because decompression is not streaming, which means it does not allow in-place decoding.

eloquentarduino commented 1 year ago

Good to know, thank you.