I am writing a program that reads in raw image data from a file and prints it to a TImage box in Delphi. The Image format is 14-bit grayscale (i.e. 16383 intensity values). I have tried to code this up using the following procedure image just isnt representative of what it should be like.
procedure TForm1.DrawImageButtonClick(Sender: TObject);
i, j: integer;
Grayshade, Red, Green, Blue: Byte;
for j := 0 to 576 do
for i:= 0 to 771 do
// This routine gets the Red, Green and Blue components and converts them into gray
Red := ImArray[i][j];
Green := ImArray[i][j] shr 8;
Blue := ImArray[i][j] shr 16;
Grayshade := Round(0.3 * Red + 0.6 * Green + 0.1 * Blue);
Image1.Canvas.Pixels[i,j] := RGB(Grayshade,Grayshade,Grayshade);
If you could point me in the right direction that would be great. I am relatively new to Delphi so if I am using totally the wrong technique then I am open to other suggestions.
Just to re-iterate, the image format is 14-bit grayscale, dont ask me why, probably something to do with the hardware where the data comes from.
Your help is much appreciated.