espressif / esp-who

Face detection and recognition framework
Other
1.64k stars 458 forks source link

fmt2rgb888 converts RGB565 in BGR888 instead of RGB888 (AIV-570) #237

Open enricoantonini84 opened 1 year ago

enricoantonini84 commented 1 year ago

I've encountered some issues with the fmt2rgb888 function: seems that the function doesn't convert an rgb565 buffer correctly to RGB 24-bit because, after inspecting the output buffer, I get a BGR 24-bit encoded image. To solve this problem, I've edited the function this way:

`... else if(format == PIXFORMAT_RGB565) { int i; uint8_t hb, lb; pix_count = src_len / 2; for(i=0; i<pix_count; i++) { hb = src_buf++; lb = src_buf++;

        *rgb_buf++ = hb & 0xF8; //R
        *rgb_buf++ = (hb & 0x07) << 5 | (lb & 0xE0) >> 3; //G
        *rgb_buf++ = (lb & 0x1F) << 3; //B
    }

} ...`

simply changing the original masking order that puts B and G before R.

Does anyone else have issues with this function?

Sandra-lol commented 1 year ago

Hi~ Could you help submit issue in repo "esp32-camera"? thanks! we see similar issue there: https://github.com/espressif/esp32-camera/pull/511