Permalink
Browse files

Merge remote-tracking branch 'mattiGH/ME/renkaat'

Conflicts:
	CV.cabal
  • Loading branch information...
2 parents bea423a + 5958b78 commit 25c49c90d5769ea3daeda8908157dea0963ed904 @aleator committed Aug 16, 2012
Showing with 2,237 additions and 4 deletions.
  1. +14 −4 CV.cabal
  2. +20 −0 CV/Bindings/Files.hsc
  3. +13 −0 CV/Bindings/Projection.hsc
  4. +28 −0 CV/Files.hs
  5. +15 −0 CV/Operations.hs
  6. +12 −0 CV/Projection.hs
  7. +1,963 −0 cbits/cvFiles.c
  8. +14 −0 cbits/cvFiles.h
  9. +150 −0 cbits/cvProjection.c
  10. +8 −0 cbits/cvProjection.h
View
@@ -66,15 +66,21 @@ Library
cbits/cvWrapLEO.h,
cbits/cvWrapCore.h,
cbits/wrapImgProc.h,
- cbits/cvIterators.h
+ cbits/cvIterators.h,
+ cbits/cvProjection.h,
+ cbits/cvFiles.h
c-sources: cbits/cvWrapLEO.c,
cbits/cvWrapCore.c,
cbits/wrapImgProc.c,
- cbits/cvIterators.c
+ cbits/cvIterators.c,
+ cbits/cvProjection.c,
+ cbits/cvFiles.c
install-includes: cbits/cvWrapLEO.h,
cbits/cvWrapCore.h,
cbits/wrapImgProc.h,
- cbits/cvIterators.h
+ cbits/cvIterators.h,
+ cbits/cvProjection.h,
+ cbits/cvFiles.h
if flag(opencv23)
cpp-options: -DOpenCV23
cc-options: -DOpenCV23
@@ -154,6 +160,8 @@ Library
,CV.Tracking
,CV.Transforms
,CV.Video
+ ,CV.Projection
+ ,CV.Files
,Utils.DrawingClass
,Utils.Function
,Utils.GeometryClass
@@ -171,7 +179,9 @@ Library
CV.Bindings.Drawing,
CV.Bindings.Error,
CV.Bindings.Features,
- CV.Bindings.Iterators
+ CV.Bindings.Iterators,
+ CV.Bindings.Projection,
+ CV.Bindings.Files
Extensions: CPP
source-repository head
View
@@ -0,0 +1,20 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+module CV.Bindings.Files where
+
+import Foreign.Ptr
+import Foreign.C.String
+import CV.Bindings.Types
+import CV.Image(BareImage)
+
+#strict_import
+
+#include <bindings.dsl.h>
+#include "cvFiles.h"
+
+#ccall read_from_tcr , CString -> Ptr (Ptr CUInt) -> IO (Ptr BareImage)
+
+#ccall read_from_tcr_rectified , CString -> IO (Ptr BareImage)
+
+#ccall read_from_tcr_mag , CString -> IO (Ptr BareImage)
+
+#ccall calc_derivative_direction , Ptr BareImage -> IO (Ptr BareImage)
@@ -0,0 +1,13 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+module CV.Bindings.Projection where
+
+import Foreign.Ptr
+import CV.Bindings.Types
+import CV.Image(BareImage)
+
+#strict_import
+
+#include <bindings.dsl.h>
+#include "cvProjection.h"
+
+#ccall project_polar , Ptr BareImage -> IO (Ptr BareImage)
View
@@ -0,0 +1,28 @@
+module CV.Files where
+
+import CV.Bindings.Files
+import CV.Image
+
+import Foreign.C.String
+import Foreign.Ptr(nullPtr, castPtr)
+import System.IO.Unsafe
+
+readFromTcr :: String -> Image GrayScale D32
+readFromTcr p = unsafePerformIO $ creatingImage $
+ withCString p $ \path ->
+ c'read_from_tcr path nullPtr
+
+readFromTcrRectified :: String -> Image GrayScale D32
+readFromTcrRectified p = unsafePerformIO $ creatingImage $
+ withCString p $ \path ->
+ c'read_from_tcr_rectified path
+
+readFromTcrMag :: String -> Image GrayScale D32
+readFromTcrMag p = unsafePerformIO $ creatingImage $
+ withCString p $ \path ->
+ c'read_from_tcr_mag path
+
+calcDerivativeDirection :: Image GrayScale D32 -> Image GrayScale D32
+calcDerivativeDirection image = unsafePerformIO $ creatingImage $
+ withImage image $ \pimage ->
+ c'calc_derivative_direction (castPtr pimage)
View
@@ -1,3 +1,4 @@
+{-# LANGUAGE ScopedTypeVariables #-}
module CV.Operations
( clear
, set
@@ -6,6 +7,7 @@ module CV.Operations
, unitNormalize
, unitStretch
, logNormalize
+, cartToPolar
) where
import CV.Bindings.Core
@@ -78,3 +80,16 @@ unitNormalize i
unitStretch i = normalize 0 1 NormMinMax i
logNormalize = unitNormalize . IM.log . (1 |+)
+
+cartToPolar :: (Image GrayScale D32, Image GrayScale D32) -> (Image GrayScale D32, Image GrayScale D32)
+cartToPolar (x,y) = unsafePerformIO $ do
+ r::(Image GrayScale D32) <- create (w, h)
+ a::(Image GrayScale D32) <- create (w, h)
+ withImage x $ \px ->
+ withImage y $ \py ->
+ withImage r $ \pr ->
+ withImage a $ \pa -> do
+ c'cvCartToPolar (castPtr px) (castPtr py) (castPtr pr) (castPtr pa) (fromIntegral 0)
+ return (r,a)
+ where
+ (w,h) = getSize x
View
@@ -0,0 +1,12 @@
+module CV.Projection where
+
+import CV.Bindings.Projection
+import CV.Image
+
+import Foreign.Ptr
+import System.IO.Unsafe
+
+projectPolar :: Image c d -> Image GrayScale D32
+projectPolar i = unsafePerformIO $ creatingImage $
+ withImage i $ \i_ptr ->
+ c'project_polar (castPtr i_ptr)
Oops, something went wrong. Retry.

0 comments on commit 25c49c9

Please sign in to comment.