Click here to Skip to main content
15,910,123 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: UNICODE option in VC6 projects? Pin
Tom Archer10-Oct-04 19:32
Tom Archer10-Oct-04 19:32 
GeneralUrgent Plz.. Help needed on converting 12 bit greylevel... Pin
Kiran Satish10-Oct-04 14:48
Kiran Satish10-Oct-04 14:48 
GeneralRe: Urgent Plz.. Help needed on converting 12 bit greylevel... Pin
Mad__10-Oct-04 23:22
Mad__10-Oct-04 23:22 
GeneralRe: Urgent Plz.. Help needed on converting 12 bit greylevel... Pin
normanS11-Oct-04 2:52
normanS11-Oct-04 2:52 
GeneralRe: Urgent Plz.. Help needed on converting 12 bit greylevel... Pin
Kiran Satish11-Oct-04 6:00
Kiran Satish11-Oct-04 6:00 
GeneralLSB_MSB format Pin
normanS11-Oct-04 3:01
normanS11-Oct-04 3:01 
GeneralRe: LSB_MSB format Pin
Kiran Satish11-Oct-04 5:59
Kiran Satish11-Oct-04 5:59 
GeneralRe: LSB_MSB format Pin
normanS11-Oct-04 20:35
normanS11-Oct-04 20:35 
Interesting - I would not have thought of using a look-up table, but it should be slightly faster than shifting right by 4.

I assume that your look-up table looks something like this:

InValue OutValue<br />
  4095     255<br />
  4094     255<br />
  . . . . <br />
  4080     255<br />
  4079     254<br />
  . . . .<br />
   16       1<br />
   15       0<br />
  . . . .<br />
    0       0


Your approach should work, as you have described it. The only change I would suggest is that you don't need to treat each bit in the MS nibble individually.

I would do something like:

  // Get the MS byte and LS byte<br />
  LSByte = getNextByteFromFile();<br />
  MSByte = getNextByteFromFile();<br />
<br />
  // get the 12-bit intensity, with 1 arithmetic operation<br />
  totalValue = (int)LSByte + ((int)MSByte)<<8;<br />
  // This is the same as:<br />
  //  totalValue = (int)LSByte + ((int)MSByte)*256;<br />
  // and it is the same as your calculation, but should be faster<br />
  // because there is only one multiply / shift.<br />
<br />
  // then use LUT to get 8-bit value<br />
  newValue = LookUpTable[totalValue];<br />
<br />
  // then make an RGB-24 pixel<br />
  RGB24 = newValue + newValue<<8 + newValue<<16;


I think that this should give you a monochrome display which is really good. In my application I grab monochrome video frames from a camera at 8 bits per pixel, then I convert to RGB16, using a similar technique to above. This only leaves 5 bits per colour, and since R, G, B are the same, this means that I only end up with 32 different shades! The image which is displayed looks pretty good, although you can sometimes see the different grey levels. Your application will have 256 different shades of grey, which should give an excellent monochrome image!
QuestionDirectShow change resolution on the fly? Pin
Indrawati10-Oct-04 14:13
Indrawati10-Oct-04 14:13 
Generalstructure with vector as a member Pin
gahziman10-Oct-04 13:30
gahziman10-Oct-04 13:30 
GeneralRe: structure with vector as a member Pin
Mad__10-Oct-04 23:25
Mad__10-Oct-04 23:25 
GeneralRe: structure with vector as a member Pin
gahziman11-Oct-04 0:34
gahziman11-Oct-04 0:34 
GeneralRe: structure with vector as a member Pin
Mad__11-Oct-04 0:39
Mad__11-Oct-04 0:39 
GeneralRe: structure with vector as a member Pin
Bob Stanneveld11-Oct-04 3:56
Bob Stanneveld11-Oct-04 3:56 
GeneralPlease help with CString to float. Pin
Jochum Wittebrood10-Oct-04 10:29
Jochum Wittebrood10-Oct-04 10:29 
GeneralRe: Please help with CString to float. Pin
Jochum Wittebrood10-Oct-04 11:07
Jochum Wittebrood10-Oct-04 11:07 
GeneralRe: Please help with CString to float. Pin
Christian Graus10-Oct-04 11:54
protectorChristian Graus10-Oct-04 11:54 
GeneralRe: Please help with CString to float. Pin
Jochum Wittebrood10-Oct-04 14:32
Jochum Wittebrood10-Oct-04 14:32 
GeneralRe: Please help with CString to float. Pin
Christian Graus10-Oct-04 14:41
protectorChristian Graus10-Oct-04 14:41 
GeneralRe: Please help with CString to float. Pin
Michael Dunn10-Oct-04 14:49
sitebuilderMichael Dunn10-Oct-04 14:49 
GeneralRe: Please help with CString to float. Pin
toxcct10-Oct-04 21:00
toxcct10-Oct-04 21:00 
GeneralRe: Please help with CString to float. Pin
callisthenes11-Oct-04 3:57
callisthenes11-Oct-04 3:57 
GeneralRe: Please help with CString to float. Pin
Jochum Wittebrood12-Oct-04 12:43
Jochum Wittebrood12-Oct-04 12:43 
GeneralRuntime ComboBox Question Pin
otrcomm10-Oct-04 9:04
otrcomm10-Oct-04 9:04 
GeneralRe: Runtime ComboBox Question Pin
Antti Keskinen10-Oct-04 9:23
Antti Keskinen10-Oct-04 9:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.