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

John Lask jvlask at hotmail.com
Wed May 18 10:57:09 CEST 2011


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 at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe




More information about the Haskell-Cafe mailing list