Re: analysing a bitmap



On Wed, 25 May 2005 16:35:48 +0200, "Peter Bauer"
<PeterBauer@xxxxxxxx> waffled on about something:

>
>> Then it exploded because you defined myimagemap as a 1 based array,
>> not 0 based one.
>
>i overwrite the array with:
>
> for y:= 0 to TempBitmap.Height-1 do
> begin
> P:= TempBitmap.ScanLine[y];
> for x:= 0 to TempBitmap.Width-1 do
> begin
> if (P^.rgbRed = 0) and (P^.rgbGreen = 0) and (P^.rgbBlue = 0) then
> MyImageMap[X, Y]:= 1
> else
> MyImageMap[X, Y]:= 0;
> end;
> end;
>
>so every black pixel is set as 1 in myimagemap

Sorry, I didn't mean the initial value of the individual array
elements, I mean the actual dimensions of the array as defined in you
code (copied below)

TCoordinateX = 1..242;
TCoordinateY = 1..102;
MyImageMap: array [TCoordinateX, TCoordinateY] of integer;

Your loop starts with x and y at zero, which means the first time you
try to set a pixel in MyImageMap you are setting MyImageMap[0,0] which
is outside the array, which on my D5 makes it go pop.

>> You appear to be getting stuck in a loop... As your fill routine is
>> self calling this eventually (i.e. a fraction of a second later) blows
>> the stack limit.
>>
>> I think this occurs when old colour=colour, although I haven't quite
>> got my head round your fill logic.
>
>thats right, now i'm skipping this with
> if OldColour=Colour then exit;

That would help. :-)

Dodgy.
--
MUSHROOMS ARE THE OPIATE OF THE MOOSES
.



Relevant Pages

  • Re: analysing a bitmap
    ... > Then it exploded because you defined myimagemap as a 1 based array, ... > the stack limit. ... > dumping coordinates to a memo1 box so you can see where it's going, ...
    (comp.lang.pascal.delphi.misc)
  • Re: analysing a bitmap
    ... >>> Then it exploded because you defined myimagemap as a 1 based array, ... border would have to be different. ... You can also offset the bitmap coordinates but one ...
    (comp.lang.pascal.delphi.misc)
  • RE: Error 3021
    ... Create proto-file names using the selected job names and storre to an array ... Save and close the document and repeat the loop ... Dim strJobsAs String, strDocsAs String, varValsAs _ ...
    (microsoft.public.access.modulesdaovba)
  • RE: Error 3021
    ... Kevin Backmann ... Create proto-file names using the selected job names and storre to an array ... Save and close the document and repeat the loop ... Dim strJobsAs String, strDocsAs String, varValsAs _ ...
    (microsoft.public.access.modulesdaovba)
  • RE: Error 3021
    ... Create proto-file names using the selected job names and storre to an array ... Save and close the document and repeat the loop ... Dim strJobsAs String, strDocsAs String, varValsAs _ ...
    (microsoft.public.access.modulesdaovba)