The code below (from this thread: http://stackoverflow.com/questions/2405899/how-to-use-delphi-2010s-new-wic-capability-on-canon-files) opens a WIC image into a BitMap.
However, if the dynamic range of WIC pixel values is large, this code loses a lot of information, since it has to scale the wide dynamic range into the low range that a Bitmap pixel can accommodate.
procedure TForm116.Button1Click(Sender: TObject);
var
WIC: TWICImage;
begin
WIC := TWICImage.Create;
try
WIC.LoadFromFile('MyFilename.raw');
Image1.Picture.Graphic.Assign(WIC);
finally
WIC.Free;
end;
end;
Can anyone show me sample code that would let me read the pixel values directly from the TWICImage, so I can access the image data without losing information? I need the intensity (gray scale) values of each pixel which perhaps can be calculated from the RGB values if not directly available?
Something like:
var
PixelValue: Integer; // Grayscale
for Row := 0 to WIC.Width do
for Col := 0 to WIC.Height
PixelValue := WIC.GetPixelValue(Row, Col);