Re: Speeding up an image transformation in C

Nils Olaf de Reus <[email protected]>
Newsgroups gmane.comp.python.image
Message-ID <1258034058.11707.32.camel@DELL0712>
On Mon, 9 Nov 2009 17:24:05 +0100, Grzegorz Adam Hankiewicz
<[email protected]> wrote:
> Hello.
>
> I have a small python algorithm similar to a floodfill that works slow
> in python. Is there any documentation on how I could write a C
extension
> to speed it up? Are there any dev headers I can compile against to
> handle an Image from C?


I would recommend in this case that you use cython. It allows you to
create a C implementation of your algorithm with a python front end, and
compile it into an extension which you can then import into regular
python code. If you use a numpy array to represent your image, it should
work exceptionally well. There is a cython tutorial for using C code
with python aimed specifically at numpy. It can be found here:
http://wiki.cython.org/tutorials

====================================================
Drs. Nils Olaf de Reus
Department of Spatial Analysis and Decision Support
Institute for Environmental Studies, VU Amsterdam
De Boelelaan 1087, 1081HV The Netherlands
Website: http://www.ivm.vu.nl
Email: [email protected]
====================================================


_______________________________________________
Image-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/image-sig
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.