Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Alright, change has been made #2

Merged
merged 4 commits into from

2 participants

This page is out of date. Refresh to see the latest.
View
4 HOpenCV.cabal
@@ -41,7 +41,7 @@ library
src/AI/CV/OpenCV/HOpenCV_wrap.c
hs-Source-Dirs: src
include-dirs: /usr/include/opencv
- extra-libraries: cv,highgui
+ extra-libraries: cxcore,cv,highgui
build-depends: base >=4 && <5, allocated-processor >= 0.0.1, vector-space
ghc-options: -Wall -fno-warn-type-defaults
@@ -54,7 +54,7 @@ executable test-hopencv
main-is: Test.hs
Ghc-Options: -Wall -fno-warn-type-defaults
Ghc-Prof-Options: -prof -auto-all
- extra-libraries: cv,highgui
+ extra-libraries: cxcore,cv,highgui
other-modules: AI.CV.OpenCV.CxCore, AI.CV.OpenCV.CV, AI.CV.OpenCV.HighGui, AI.CV.OpenCV.Types
View
26 src/AI/CV/OpenCV/HighGui.hs → src/AI/CV/OpenCV/HighGui.hsc
@@ -10,6 +10,7 @@ import Foreign.C.String
import AI.CV.OpenCV.CxCore
+#include <highgui.h>
------------------------------------------------
-- General
@@ -72,3 +73,28 @@ foreign import ccall unsafe "HOpenCV_wrap.h show_image"
foreign import ccall unsafe "highgui.h cvWaitKey"
waitKey :: CInt -> IO CInt
+
+foreign import ccall unsafe "highgui.h cvNamedWindow"
+ cvNamedWindow :: CString -> CInt -> IO CInt
+
+type AutoSize = Bool
+
+titledWindow :: String -> AutoSize -> IO Int
+titledWindow s a
+ = do cs <- newCString s
+ i <- cvNamedWindow cs (fromToInteger $ fromEnum a)
+ return $ fromToInteger i
+
+fromToInteger :: (Integral a, Num b) => a -> b
+fromToInteger = fromInteger . toInteger
+
+newtype LoadImageColor = LoadImageColor { unLoadImageColor :: CInt }
+
+#{enum LoadImageColor, LoadImageColor
+ , loadImageColor = CV_LOAD_IMAGE_COLOR
+ , loadImageGrayscale = CV_LOAD_IMAGE_GRAYSCALE
+ , loadImageUnchanged = CV_LOAD_IMAGE_UNCHANGED }
+
+foreign import ccall unsafe "highgui.h cvLoadImage"
+ cvLoadImage :: CString -> CInt -> IO (Ptr IplImage)
+
View
3  src/AI/CV/OpenCV/Types.hs
@@ -5,9 +5,6 @@ import AI.CV.OpenCV.CxCore
import AI.CV.OpenCV.HighGui
import Foreign
-import Foreign.ForeignPtr
-
-
type PImage = Ptr IplImage
type PCapture = Ptr CvCapture
Something went wrong with that request. Please try again.