module CV.Gabor where
import CV.Image
import CV.Filters
import CV.Image
import CV.Filters
import System.IO.Unsafe
import Foreign.C.Types
import Foreign.Ptr
import CV.Transforms
newtype GaborMask = GaborMask (CInt,CInt,CDouble,CDouble,CDouble,CDouble,CDouble)
gaborImage (width,height,dx,dy,stdX,stdY,theta,phase,cycles) =
unsafePerformIO $ do
img :: Image GrayScale D32<- create (width,height)
withGenImage img $ \i ->
renderGabor i (fromIntegral width) (fromIntegral height)
dx dy stdX stdY theta phase cycles
return img
gaborFiltering (GaborMask (width,height,stdX,stdY,theta,phase,cycles)) image =
unsafePerformIO $
withClone image $ \img ->
withGenImage img $ \clone ->
withGenImage image $ \original ->
gaborFilter original clone width height
stdX stdY theta phase cycles
radialGaborFiltering (width,height,sigma,phase
,center,cycles) image =
unsafePerformIO $
withClone image $ \img ->
withGenImage img $ \clone ->
withGenImage image $ \original ->
radialGaborFilter original clone
width height
sigma phase center cycles
radialGaborImage (width,height,sigma,phase
,center,cycles) =
unsafePerformIO $ do
img :: Image GrayScale D32 <- create (width,height)
withGenImage img $ \i ->
renderRadialGabor i (fromIntegral width) (fromIntegral height) sigma
phase center cycles
return img
foreign import ccall safe "CV/Gabor.chs.h renderGabor"
renderGabor :: ((Ptr ()) -> (CInt -> (CInt -> (CDouble -> (CDouble -> (CDouble -> (CDouble -> (CDouble -> (CDouble -> (CDouble -> (IO ())))))))))))
foreign import ccall safe "CV/Gabor.chs.h gaborFilter"
gaborFilter :: ((Ptr ()) -> ((Ptr ()) -> (CInt -> (CInt -> (CDouble -> (CDouble -> (CDouble -> (CDouble -> (CDouble -> (IO ()))))))))))
foreign import ccall safe "CV/Gabor.chs.h radialGaborFilter"
radialGaborFilter :: ((Ptr ()) -> ((Ptr ()) -> (CInt -> (CInt -> (CDouble -> (CDouble -> (CDouble -> (CDouble -> (IO ())))))))))
foreign import ccall safe "CV/Gabor.chs.h renderRadialGabor"
renderRadialGabor :: ((Ptr ()) -> (CInt -> (CInt -> (CDouble -> (CDouble -> (CDouble -> (CDouble -> (IO ()))))))))