Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Geek Culture / Get colour from 16 bit raw data.

Author
Message
Code eater
17
Years of Service
User Offline
Joined: 17th Feb 2008
Location: Behind You!
Posted: 16th Mar 2010 20:07 Edited at: 16th Mar 2010 21:00
Hey,

I am working on getting a camera that works through the serial port working on a processor of some kind (probably an ARM). But now I am working on getting it to work with my PC. I am writing in c# and can get an array on bytes describing the image.

It is an 80x60 image using 16 bit colour. So overall it is 9600 bytes (80*60*(16/8)). One pixel may look like 0x0e, 0xaa. This equals 3754 in a decimal number system.
I need to get the Red, Green and Blue components from this number and i have no idea how.

Anyone got any ideas?

[edit] Just corrected some typos

Thanks,,,

Codeeater
dark coder
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 16th Mar 2010 22:39
You want to look for how to extract nibbles from a byte, which is quite easy if you know your bitwise operators!

Login to post a reply

Server time is: 2025-05-24 20:33:40
Your offset time is: 2025-05-24 20:33:40