[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] [PATCH] fix incorrect behavior and performance in mask.get_bounding_rects()
hi,
I think we'll add all of your patches after 1.8.1 is released this weekend.
Nicholas and I wrote some tests for Mask.get_bounding_rects, and
transform.threshold... However I think it's a bit late to test them
properly still, and might as well add them to pygame 1.9 starting this
weekend.
cheers,
On Sun, Jul 13, 2008 at 12:53 PM, René Dudfield <renesd@xxxxxxxxx> wrote:
> Thanks for the patch. I'm looking it over today.
>
> Firstly I'm writing some more extensive test cases for it.
>
> cheers,
>
>
>
> On Sat, Jul 12, 2008 at 4:28 PM, Nirav Patel <olpc@xxxxxxxxxxxxxx> wrote:
>> In testing some computer vision stuff I was writing, I found that
>> mask.get_bounding_rects() often split a connected component into
>> multiple bounding boxes. Specifically in the following case:
>>
>> 0011
>> 1111
>>
>> It would split the 11 in the first row and the 1111 in the second row
>> into separate connected components, and therefore separate bounding
>> boxes.
>>
>> I wrote a new version of it based on the algorithm I used in
>> mask.connected_component. It correctly detects connected components,
>> and there is also a side benefit of an, on average, 2x increase in
>> performance.
>>
>> I attached the functions that I changed, and the full mask.c is
>> available in my repo, though it also contains other functions that I'm
>> proposing for 1.9.
>> http://git.n0r.org/?p=pygame-nrp;a=blob;f=src/mask.c
>>
>> Nirav
>>
>