Open CV or alternate image processing library for Haskell on windows?

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? -------------------------------------------

On Mon, May 16, 2011 at 8:37 AM, Gregory Guthrie
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.

Below is the install result. It does claim that "You must install OpenCV (development packages) prior to installing this package." I don't' see any Haskell /cabal opencv package, so am not sure what this means one has to do. I am not familiar enough with the Haskell install and make environment to go hacking into it, I was hoping for a simple cabal install! Thanks for the note and pointers. I am a bit surprised at the lack of graphics and Image processing libraries. I found several for Unix/Linux only, and their installs on Windows fail. I also love Linux, but windows is the 93% market share, and our student labs are all windows. I am trying to advocate using FP in more of our undergraduate level courses, and thought this might be a good area; perhaps not. Are the two packages for Hopencv the two on the hackage page? It looked to me like only one was claimed to be current and mostly complete. --------------------------------------------------- C:\Users\guthrie>cabal install hopencv Resolving dependencies... Configuring HOpenCV-0.1.2.2... Warning: 'include-dirs: /usr/include/opencv' directory does not exist. Warning: 'include-dirs: /usr/include/opencv' directory does not exist. cabal: Missing dependencies on foreign libraries: * Missing C libraries: cv, highgui, cv, highgui This problem can usually be solved by installing the system packages that provide these libraries (you may need the "-dev" versions). If the libraries are already installed but in a non-standard location then you can use the flags --extra-include-dirs= and --extra-lib-dirs= to specify where they are. cabal: Error: some packages failed to install: HOpenCV-0.1.2.2 failed during the configure step. The exception was: ExitFailure 1 C:\Users\guthrie>cabal install cv Resolving dependencies... Configuring unix-2.4.2.0... cabal: The package has a './configure' script. This requires a Unix compatibility toolchain such as MinGW+MSYS or Cygwin. cabal: Error: some packages failed to install: CV-0.3.0.1 depends on unix-2.4.2.0 which failed to install. JYU-Utils-0.1.1.1 depends on unix-2.4.2.0 which failed to install. unix-2.4.2.0 failed during the configure step. The exception was: ExitFailure 1 C:\Users\guthrie>cabal install highgui cabal: There is no package named 'highgui'. You may need to run 'cabal update' to get the latest list of available packages. -------------------------------------------
-----Original Message----- From: Casey McCann [mailto:syntaxglitch@gmail.com] Sent: Monday, May 16, 2011 1:18 PM To: Gregory Guthrie Cc: haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] Open CV or alternate image processing library for Haskell on windows?
I wanted to look into using Haskell for an introductory Image Processing class, but the main
On Mon, May 16, 2011 at 8:37 AM, Gregory Guthrie
wrote: 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.

On Mon, May 16, 2011 at 10:47 PM, Gregory Guthrie
Below is the install result. It does claim that "You must install OpenCV (development packages) prior to installing this package." I don't' see any Haskell /cabal opencv package, so am not sure what this means one has to do.
The error isn't referring to a Haskell package - it is saying that it cannot find the libraries installed on your computer. Note the line "Missing C libraries: cv, highgui, cv, highgui". These are not referring to Haskell packages - they are referring to libcv and libhighgui, whatever those are. What sort of computer are you using? Antoine
I am not familiar enough with the Haskell install and make environment to go hacking into it, I was hoping for a simple cabal install!
Thanks for the note and pointers. I am a bit surprised at the lack of graphics and Image processing libraries. I found several for Unix/Linux only, and their installs on Windows fail.
I also love Linux, but windows is the 93% market share, and our student labs are all windows. I am trying to advocate using FP in more of our undergraduate level courses, and thought this might be a good area; perhaps not.
Are the two packages for Hopencv the two on the hackage page? It looked to me like only one was claimed to be current and mostly complete. ---------------------------------------------------
C:\Users\guthrie>cabal install hopencv Resolving dependencies... Configuring HOpenCV-0.1.2.2... Warning: 'include-dirs: /usr/include/opencv' directory does not exist. Warning: 'include-dirs: /usr/include/opencv' directory does not exist. cabal: Missing dependencies on foreign libraries: * Missing C libraries: cv, highgui, cv, highgui This problem can usually be solved by installing the system packages that provide these libraries (you may need the "-dev" versions). If the libraries are already installed but in a non-standard location then you can use the flags --extra-include-dirs= and --extra-lib-dirs= to specify where they are. cabal: Error: some packages failed to install: HOpenCV-0.1.2.2 failed during the configure step. The exception was: ExitFailure 1
C:\Users\guthrie>cabal install cv Resolving dependencies... Configuring unix-2.4.2.0... cabal: The package has a './configure' script. This requires a Unix compatibility toolchain such as MinGW+MSYS or Cygwin. cabal: Error: some packages failed to install: CV-0.3.0.1 depends on unix-2.4.2.0 which failed to install. JYU-Utils-0.1.1.1 depends on unix-2.4.2.0 which failed to install. unix-2.4.2.0 failed during the configure step. The exception was: ExitFailure 1
C:\Users\guthrie>cabal install highgui cabal: There is no package named 'highgui'. You may need to run 'cabal update' to get the latest list of available packages.
-------------------------------------------
-----Original Message----- From: Casey McCann [mailto:syntaxglitch@gmail.com] Sent: Monday, May 16, 2011 1:18 PM To: Gregory Guthrie Cc: haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] Open CV or alternate image processing library for Haskell on windows?
I wanted to look into using Haskell for an introductory Image Processing class, but the main
On Mon, May 16, 2011 at 8:37 AM, Gregory Guthrie
wrote: 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.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Hi,
I have little knowledge about windows in general, but CV package requires
that you install
the opencv c-libraries. You will find them at
http://opencv.willowgarage.com/. Including
a windows distribution.
However, CV package has not been tried on windows, so there might or might
not
be trouble that way. If you run into that said trouble, write a ticket at
https://github.com/aleator/CV/issues and I can try to take a look
Kind regards,
Ville
On 17 May 2011 07:34, Antoine Latter
On Mon, May 16, 2011 at 10:47 PM, Gregory Guthrie
wrote: Below is the install result. It does claim that "You must install OpenCV (development packages) prior to installing this package." I don't' see any Haskell /cabal opencv package, so am not sure what this means one has to do.
The error isn't referring to a Haskell package - it is saying that it cannot find the libraries installed on your computer.
Note the line "Missing C libraries: cv, highgui, cv, highgui". These are not referring to Haskell packages - they are referring to libcv and libhighgui, whatever those are.
What sort of computer are you using?
Antoine
I am not familiar enough with the Haskell install and make environment to
go hacking into it, I was hoping for a simple cabal install!
Thanks for the note and pointers. I am a bit surprised at the lack of
graphics and Image processing libraries. I found several for Unix/Linux only, and their installs on Windows fail.
I also love Linux, but windows is the 93% market share, and our student
labs are all windows. I am trying to advocate using FP in more of our undergraduate level courses, and thought this might be a good area; perhaps not.
Are the two packages for Hopencv the two on the hackage page? It looked
---------------------------------------------------
C:\Users\guthrie>cabal install hopencv Resolving dependencies... Configuring HOpenCV-0.1.2.2... Warning: 'include-dirs: /usr/include/opencv' directory does not exist. Warning: 'include-dirs: /usr/include/opencv' directory does not exist. cabal: Missing dependencies on foreign libraries: * Missing C libraries: cv, highgui, cv, highgui This problem can usually be solved by installing the system packages that provide these libraries (you may need the "-dev" versions). If the
are already installed but in a non-standard location then you can use the flags --extra-include-dirs= and --extra-lib-dirs= to specify where they are. cabal: Error: some packages failed to install: HOpenCV-0.1.2.2 failed during the configure step. The exception was: ExitFailure 1
C:\Users\guthrie>cabal install cv Resolving dependencies... Configuring unix-2.4.2.0... cabal: The package has a './configure' script. This requires a Unix compatibility toolchain such as MinGW+MSYS or Cygwin. cabal: Error: some packages failed to install: CV-0.3.0.1 depends on unix-2.4.2.0 which failed to install. JYU-Utils-0.1.1.1 depends on unix-2.4.2.0 which failed to install. unix-2.4.2.0 failed during the configure step. The exception was: ExitFailure 1
C:\Users\guthrie>cabal install highgui cabal: There is no package named 'highgui'. You may need to run 'cabal update' to get the latest list of available packages.
-------------------------------------------
-----Original Message----- From: Casey McCann [mailto:syntaxglitch@gmail.com] Sent: Monday, May 16, 2011 1:18 PM To: Gregory Guthrie Cc: haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] Open CV or alternate image processing
windows?
I wanted to look into using Haskell for an introductory Image Processing class, but the main
On Mon, May 16, 2011 at 8:37 AM, Gregory Guthrie
wrote: 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
saw on Hackage seem to advertise themselves as emphatically not
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
to me like only one was claimed to be current and mostly complete. libraries library for Haskell on packages offer? Both that I production-ready code and 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.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Yes, I understand that - but if there is some install or usage dependency, or install procedure, I would hope to see it documented somewhere; perhaps I missed that? The end result is that from the project page and install, it fails. :-) Earlier in the thread I noted that this was a Windows (w7 enterprise) system. (I have first installed the standard Opencv distribution which should provide the cv libraries, but that did not help.) The HOpenCv package page at hackage only describes Linux installation. -------------------------------------------
-----Original Message----- From: Antoine Latter [mailto:aslatter@gmail.com] The error isn't referring to a Haskell package - it is saying that it cannot find the libraries installed on your computer.
Note the line "Missing C libraries: cv, highgui, cv, highgui". These are not referring to Haskell packages - they are referring to libcv and libhighgui, whatever those are.
What sort of computer are you using?

Hi, Yes, I understand that - but if there is some install or usage dependency,
or install procedure, I would hope to see it documented somewhere; perhaps I missed that?
The only installation procedure I can document is how to do this in linux. My guess is that it must be similar with windows. 1. Get the opencv library from opencv.willowgarage.com 2. Install it and make a note where it installs 3. cabal install CV. If this fails with missing C libraries, then, (4). cabal install CV --with-extra-lib-dirs=where_the_opencv_libs_are --with-extra-include-dirs=where_the_opencv_includes_are However, wait few hours so I can push a new version to hackage. There are few things I've already discovered that fail to work with other people and I think I can fix them. Disclaimer: The CV package is something I threw together, originally in pre-cabal times. Back then I arguably wasn't a very good haskell-programmer and the whole thing was under an nda. Since then I've casually evolved the library to suit my needs. After I saw CV-combinators library released I made a petition to publish my codes in hopes that it would help other people doing similar things. In short, although CV package is very very useful for me, it is not a perfect binding, and the implementation isn't really smart at places. I would like to make it great, however.

On 18/05/2011 2:02 PM, Ville Tirronen wrote: Hello, I have successfully* built HOpenCV on windows with openCV 2.0 on windows (XP). * by successfully, I mean compiled and linked, library and test.hs. The test did give me an error: test-hopencv.exe: user error (Failed to create camera) which, I have not bothered to follow up any further. The build process was as follows (your paths will differ): 1) I installed openCV to C:\apps\OpenCV2.0 2) I unzipped HOpenCV-0.1.2.2 to some directory 3) edited cabal file edited the following entries to include-dirs: c:\apps\OpenCV2.0\include\opencv extra-lib-dirs: c:\apps\OpenCV2.0\lib and also edited the extra-libraries to ... extra-libraries: highgui200, cv200, cxcore200 4) then set Path=%PATH%;c:\apps\OpenCV2.0\bin unless when installing OpenCV you added the install path to your path.. 5) then ghc Setup build "--hsc2hs-options=-L -Wl,-(" the "--hsc2hs-options=-L -Wl,-(" option is neccessary in order to ovoid errors like dist\ghc\6.12.3\build\AI\CV\OpenCV\CV_hsc_make.o:CV_hsc_make.c:(.text+0x85a): un defined reference to `cvFree_' for some reason (and I really can't understand why) gcc requires the highgui200, cv200, cxcore200 libraries after the object (normally dosn't) and the "-L -Wl,-(" instructs hsc2hs to pass -Wl,-C to gcc, which in turn instructs gcc to pas -( to the linker which in turn tells the linker to re-read the libraries to resolve the references. (somewhere something is going wrong) 6) run the test ...
Hi,
Yes, I understand that - but if there is some install or usage dependency,
or install procedure, I would hope to see it documented somewhere; perhaps I missed that?
The only installation procedure I can document is how to do this in linux. My guess is that it must be similar with windows.
1. Get the opencv library from opencv.willowgarage.com 2. Install it and make a note where it installs 3. cabal install CV. If this fails with missing C libraries, then, (4). cabal install CV --with-extra-lib-dirs=where_the_opencv_libs_are --with-extra-include-dirs=where_the_opencv_includes_are
However, wait few hours so I can push a new version to hackage. There are few things I've already discovered that fail to work with other people and I think I can fix them.
Disclaimer: The CV package is something I threw together, originally in pre-cabal times. Back then I arguably wasn't a very good haskell-programmer and the whole thing was under an nda. Since then I've casually evolved the library to suit my needs. After I saw CV-combinators library released I made a petition to publish my codes in hopes that it would help other people doing similar things.
In short, although CV package is very very useful for me, it is not a perfect binding, and the implementation isn't really smart at places. I would like to make it great, however.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Hey thanks a bunch! Just to clarify matters: HOpenCV is an alternative (and more refined) effort of binding opencv, while CV package is set of bindings I've developed around opencv for various projects I've been involved with. But I'm pretty certain that the same steps for building work for both. Is there anyone on the list who cares to try?
test-hopencv.exe: user error (Failed to create camera)
which, I have not bothered to follow up any further.
Just out of curiosity, what kind of camera did you have plugged in at the time? Ville

Thanks! I’ll wait, and then try this later today. And another previous note also described a successful install, I can also try that. It seems to me that having easy install of such common libraries is a big advantage of C++/C#/.. even SML(!), and is important to wider usage of Haskell. -------------------------------------------------------- From: Ville Tirronen [mailto:aleator@gmail.com] Sent: Tuesday, May 17, 2011 11:33 PM To: Gregory Guthrie Cc: haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] Open CV or alternate image processing library for Haskell on windows? Hi, Yes, I understand that - but if there is some install or usage dependency, or install procedure, I would hope to see it documented somewhere; perhaps I missed that? The only installation procedure I can document is how to do this in linux. My guess is that it must be similar with windows. 1. Get the opencv library from opencv.willowgarage.comhttp://opencv.willowgarage.com 2. Install it and make a note where it installs 3. cabal install CV. If this fails with missing C libraries, then, (4). cabal install CV --with-extra-lib-dirs=where_the_opencv_libs_are --with-extra-include-dirs=where_the_opencv_includes_are However, wait few hours so I can push a new version to hackage. There are few things I've already discovered that fail to work with other people and I think I can fix them. Disclaimer: The CV package is something I threw together, originally in pre-cabal times. Back then I arguably wasn't a very good haskell-programmer and the whole thing was under an nda. Since then I've casually evolved the library to suit my needs. After I saw CV-combinators library released I made a petition to publish my codes in hopes that it would help other people doing similar things. In short, although CV package is very very useful for me, it is not a perfect binding, and the implementation isn't really smart at places. I would like to make it great, however.
participants (5)
-
Antoine Latter
-
Casey McCann
-
Gregory Guthrie
-
John Lask
-
Ville Tirronen