[Haskell-cafe] Open CV or alternate image processing library for Haskell on windows?

Casey McCann syntaxglitch at gmail.com
Mon May 16 20:18:18 CEST 2011

On Mon, May 16, 2011 at 8:37 AM, Gregory Guthrie <guthrie at mum.edu> wrote:
> I wanted to look into using Haskell for an introductory Image Processing class, but the main package used for such things (OpenCV) does not appear to be available for windows systems.
> Is there some other good option for image processing in Haskell, or has anyone ported openCV to a windows Leksah environment?

Which package are you having difficulty with? OpenCV is a library
written in C/C++ and appears to work on Windows, and there looks to be
two different packages on Hackage providing bindings to it, neither of
which seems to have any issues with Windows. One does rely on the unix
package, but my understanding is that Cygwin is sufficient for
that--not certain about the details, though. I haven't used any of
these packages or OpenCV itself personally, so there may be further
issues I'm not seeing, but I would guess that any difficulty you've
encountered was a matter of build tools and system configuration, not
the libraries themselves.

I have found it necessary on multiple occasions to do manual tweaks
and jury-rigging when installing FFI bindings from Hackage on Windows,
as opposed to the typically seamless process of installing an external
library from standard repositories on Ubuntu and then bindings from
Hackage. Admittedly this may be due in large part to the horrendous
condition of build tools on my Windows system. I believe I have two
different GHCs and no less than four copies of GCC in different
locations and I've given up on making sense of it since I'm rarely on
my Windows machine when coding Haskell anyway.

Incidentally, have you looked at what functionality the bindings
packages offer? Both that I saw on Hackage seem to advertise
themselves as emphatically not production-ready code and probably
don't expose all the features of OpenCV. Before you put a lot of time
into fixing build problems, you may want to verify that they even
provide what you need. As a last resort, writing your own Haskell FFI
bindings to a C library is sometimes tedious but not usually
difficult, and there are tools to help automate the task.

I'm not aware of any other existing packages in Haskell for image
processing or computer vision. Depending on what you need, you could
write FFI bindings (to OpenCV or something else) or, if you mostly
want to work with raw data instead of using algorithms provided by the
library, there was actually a question on Stack Overflow recently that
may be relevant: http://stackoverflow.com/questions/6006304

- C.

More information about the Haskell-Cafe mailing list