Re: analysing a bitmap
- From: "Maarten Wiltink" <maarten@xxxxxxxxxxxxxxxxxx>
- Date: Wed, 25 May 2005 17:25:36 +0200
"Dodgy" <Dodgy@xxxxxxxxxxxxxxxxxxxxx> wrote in message
news:ci499112otv5u9rqgbpdl4bs3886nljp3r@xxxxxxxxxx
> 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;
I wrote the sample code. It was an essential feature that the image
array was one-based; otherwise the checks for stopping at the
border would have to be different. But bitmaps are zero-based so
you really have to offset the image array when copying between it
and the bitmap. You can also offset the bitmap coordinates but one
of them has to give.
[...]
> 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.
Peter, at this point you enable range checking. And overflow checking,
and that third option in that little group that I can't think of right
now. And don't turn them off again. Anywhere. Ever.
Just to be on the paranoid side, do you have short-circuit Boolean
evaluation enabled?
>>> 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. :-)
That should not be necessary. The fill logic is "(1) paint the new colour
at the current coordinate; (2) for all four directions, check if the fill
should continue and if it should, let it."
I haven't had the time to try and duplicate the result of oscillating
between Y=0 and Y=1. (Y should never reach 0 to begin with, it violates
the condition "Low(Y)<Y".) I'll look at it tonight.
Peter, what image are you using to test with? Does it generate a "mask"
of a blob of zeroes in the middle with ones for black all around the
border? If so, the fill should not even reach the border based on the
colour data.
Something odd is happening here.
Groetjes,
Maarten Wiltink
.
- References:
- analysing a bitmap
- From: Peter Bauer
- Re: analysing a bitmap
- From: Dodgy
- Re: analysing a bitmap
- From: Peter Bauer
- Re: analysing a bitmap
- From: Dodgy
- analysing a bitmap
- Prev by Date: Re: analysing a bitmap
- Next by Date: Re: analysing a bitmap
- Previous by thread: Re: analysing a bitmap
- Next by thread: Re: analysing a bitmap
- Index(es):
Relevant Pages
|
|