Re: analysing a bitmap




> 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

> 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;

> It might be worth sticking some showmessages in your fill routine, or
> dumping coordinates to a memo1 box so you can see where it's going,
> and what it's doing.
>
> With my test image the y coordinate decreased from where I started to
> 0 then sat going 0,1,0,1,0,1 until the stack went pop.

yes, at the moment i'm to dump to handle this methode,
not easy to cut a char of a word :)


.



Relevant Pages

  • Re: analysing a bitmap
    ... >> Then it exploded because you defined myimagemap as a 1 based array, ... TCoordinateX = 1..242; ... Your loop starts with x and y at zero, which means the first time you ...
    (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)