Scanline Enigma



Hello folks, my name is Kevin and I have a problem. I have been writing an
application for the

serious scientific investigation of images from the Martian surface by the
MER rovers.

The program is called MERDAT, I came across what appear to be random errors
while attempting to

join 2 images with similar dimensions. I get the occasional Access
Violation. After trying to pin

down the cause and searching on the Net, I feel my problem is related to the
scanline enigma.
I am also hoping that the problem is in fact myself and my lack of Delphi
knowledge.
So, may I ask that the code below be looked at. I have created an
application that only performs an

image join and reports the goings on to a log file. This application I have
called ScanlineEnigma1.

ScanlineEnigma1 and its source code links are available from,

http://www.vk3ukf.com/vk3ukf_files/AllSoftware.htm

and click on the ScanlineEnigma link on the page body.

or

The actual page without the menu frame on the left,

http://www.vk3ukf.com/vk3ukf_files/Delphi/ScanlineEnigma1.htm

I am new to making posts to the Delphi community about problems with code, I
have attempted to

present all the information and code. If I have failed in some manner,
please inform me, and I will

rectify it as soon as possible.

Below is the code I made to join 2 images using Scanline. If you see
something wrong with the code

I am using, please point out the err.

//===================================================
// code examples scanline join method 1
//===================================================
procedure TForm1.Button19Click(Sender: TObject);
Var //
x, y, W, H : integer;
begin
//
Label5.Caption := '>>> MERGE METHOD 1 (ATTEMPT)';
Button10.Click; // Process into Log File
W := (BitmapX1.Width + BitmapX1.Width);
H := (BitmapX1.Height);
BitmapXOut.Width := W;
BitmapXOut.Height := H;
SetLength(ScanlinesOut, H);
for y := 0 to H-1 do ScanlinesOut[y] := BitmapXOut.ScanLine[y];
for y := 0 to H-1 do
begin
for x := 0 to W-1 do
begin
begin
ScanlinesOut[y][x].R := (Scanlines1[y][x].R) - 256 shr 9;
ScanlinesOut[y][x].G := (Scanlines1[y][x].G) - 256 shr 9;
ScanlinesOut[y][x].B := (Scanlines1[y][x].B) - 256 shr 9;
end;
end;
for x := H-1 to W-1 do
begin
begin
ScanlinesOut[y][x].R := (Scanlines2[y][x].R) - 256 shr 9;
ScanlinesOut[y][x].G := (Scanlines2[y][x].G) - 256 shr 9;
ScanlinesOut[y][x].B := (Scanlines2[y][x].B) - 256 shr 9;
end;
end;
end;
Image3.Picture.Bitmap := BitmapXOut;
//
Label5.Caption := '>>> MERGE METHOD 1 (SUCCESS)';
Button10.Click; // Process into Log File
end;
//===================================================
// code examples scanline join method 1
//===================================================


I hope there is a simple solution to this, such as, I didn't do something I
should have.
It is my intention to place this message on several forums and wait a while,
if no solution has

come to hand I will then ask an individual or two for help.

The platform I am using is XP sp2.

Any help will sure be appreciated.
Thanks in advance, Kevin Forbes, VK3UKF.


.


Quantcast