Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Scanline Enigma

0 views
Skip to first unread message

Kevin Forbes VK3KUF

unread,
Mar 27, 2008, 8:04:57 AM3/27/08
to
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.


Jamie

unread,
Mar 27, 2008, 7:59:58 PM3/27/08
to
You have a couple of problems here.
First of all, You must make sure your image is a fixed format of
pixels.
You don't show what your scanline array type is so I can't see
what it is composed of.
First of all, Make sure you packed your type or record when
you declared a R,G,B type incase you are intending to have 24 bit
images which are 3 bytes. If you don't indicate PACKED in the record
format, it'll end up being 4 bytes and thus, your size format will
be wrong.
If how ever, you're using the TRGBQuadd for example, then your images
should be a 32 bit DIB..
You can make sure that all images are of a fixed type by setting the
Pixelformat property which will force a conversion after the image has
been placed in the Tbitmap object.
MyBitmap.PixelFormat := pf32bit;
Using a 32 bit image will speed things up for you because you can then
create a single pixel read instead of what you're doing now..

Make sure all images are forced to the correct type format you have
used in your Type in the array of lines.
if a 24 bit image is what you want, then only a 3 byte size type R,G,B
is to be used with the PACKED keyword to make sure it does not align the
record.
This wy, the X indexing will be correctly calculated.
An RGBTRIPLE record will be 3 bytes.

etc..
I'm sure you have some better understanding now.


http://webpages.charter.net/jamie_5"

0 new messages