Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

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/...lineEnigma1.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.



Report this thread to moderator Post Follow-up to this message
Old Post
Kevin Forbes VK3KUF
03-27-08 01:18 PM


Re: Scanline Enigma
Kevin Forbes VK3KUF wrote:
> 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 error
s
> 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 t
he
> 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 hav
e
> 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/...lineEnigma1.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 whil
e,
> 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.
>
>
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"


Report this thread to moderator Post Follow-up to this message
Old Post
Jamie
03-28-08 12:33 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Delphi archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 09:09 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.