Skip to content

feature request: RGB565 convert to RGB888 function #11

@hpssjellis

Description

@hpssjellis

Many machine learning programs expect RGB888 image format, wondering if a function that does that could be included in this library

I am loading my images to EdgeImpulse and using this conversion

void r565_to_rgb(uint16_t color, uint8_t *r, uint8_t *g, uint8_t *b) {

    *r = (color & 0xF800) >> 8;
    *g = (color & 0x07E0) >> 3;
    *b = (color & 0x1F) << 3;
}

I get an image like this. Note the image has already been cropped to 48x48 so the it will look grainy.

frame06

which becomes slightly better with this conversion

void r565_to_rgb(uint16_t color, uint8_t *r, uint8_t *g, uint8_t *b) {

      *r = ((((color >> 3) & 0x1F) * 527) + 23) >> 6;
      *g = ((((((color & 0xE0) >> 5) | ((color & 0x03) << 3)) & 0x3F) * 259) + 33) >> 6;
      *b = (((color & 0x1F) * 527) + 23) >> 6;
}

frame07-nano-fast06

Any suggestions on how to better convert the OV7670 RGB565 output?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions