Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RGB888 to RGB565 #6

Open
thanhtantran opened this issue Nov 4, 2022 · 1 comment
Open

RGB888 to RGB565 #6

thanhtantran opened this issue Nov 4, 2022 · 1 comment

Comments

@thanhtantran
Copy link

Hello,

My camera record with RGB888 but the screen is RGB565, how to convert it?

@ConstantRobotics
Copy link

int j = 0;
for (int i = 0; i < src.size; i = i + 3 , ++j)
{
// 5 bits for blue (bits 0-4).
uint16_t b = (uint16_t)((src.data[i] >> 3) & 0x1F);
// 6 bits for green (bits 5-10).
uint16_t g = (uint16_t)((src.data[i + 1] >> 2) & 0x3F);
// 5 bits for red (bits 11-15).
uint16_t r = (uint16_t)((src.data[i + 2] >> 3) & 0x1F);
m_rgb565[j] = (r << 11) | (g << 5) | b;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants