[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()
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] [PATCH] fix incorrect behavior and performance in mask.get_bounding_rects()
- From: "René Dudfield" <renesd@xxxxxxxxx>
- Date: Sun, 13 Jul 2008 12:53:49 +1000
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Sat, 12 Jul 2008 22:53:52 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=IqWy0fQ0L1xRD/9n/shhtwh3TvZyA8Mx8jlCrVi1G+U=; b=p0QwZ3lf04d1YYFdHZG0jucp/WSR/AUWGfPYvS4dLdd4NO1fIGgNO5pysCAgsEmbnD 6a5IFlb0VfGUQylwNsDeH9C7NW6nmgkYN/KCXkBNR4BAjSAG6+4PD7v4k6QdPCl/pr4E NhCxLhUO4QFdK1USiVTyjrdMxNR18YeDdeQOE=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=H+HH5FqZr0PQ8TgAIN9KH6SkFZ71cRxnPZCOfCSTkJOEjFhgcXbxPZk4K93+Wl51Kx byZ5oSYWRQ+fH5+Dj1QggIfTiq35nwIuDeKxV3lVwGyfUhoSP1jFB+tIfIoSFy5a9gdw OLv1b6FXilgkgBpbUvbSPFaVfXEgK+r8Czhqw=
- In-reply-to: <a7215bb70807112328t24368d61nab4f77cae0f00980@xxxxxxxxxxxxxx>
- References: <a7215bb70807112328t24368d61nab4f77cae0f00980@xxxxxxxxxxxxxx>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
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
>