opencv-extra-0.0.0.1: Haskell binding to OpenCV-3.x extra modules

Safe HaskellNone
LanguageHaskell2010

OpenCV.Extra.XFeatures2d

Contents

Synopsis

SURF

data Surf Source #

Instances

WithPtr Surf Source # 

Methods

withPtr :: Surf -> (Ptr (C Surf) -> IO b) -> IO b

FromPtr Surf Source # 

Methods

fromPtr :: IO (Ptr (C Surf)) -> IO Surf

type C Surf Source # 
type C Surf

data SurfParams Source #

Constructors

SurfParams 

Fields

surfDetectAndCompute Source #

Arguments

:: Surf 
-> Mat (S '[height, width]) channels depth

Image.

-> Maybe (Mat (S '[height, width]) (S 1) (S Word8))

Mask.

-> CvExcept (Vector KeyPoint, Mat D D D) 

Detect keypoints and compute descriptors

Example:

surfDetectAndComputeImg
    :: forall (width    :: Nat)
              (height   :: Nat)
              (channels :: Nat)
              (depth    :: *)
     . (Mat (ShapeT [height, width]) ('S channels) ('S depth) ~ Frog)
    => Mat (ShapeT [height, width]) ('S channels) ('S depth)
surfDetectAndComputeImg = exceptError $ do
    (kpts, _descs) <- surfDetectAndCompute surf frog Nothing
    withMatM (Proxy :: Proxy [height, width])
             (Proxy :: Proxy channels)
             (Proxy :: Proxy depth)
             white $ \imgM -> do
      void $ matCopyToM imgM (V2 0 0) frog Nothing
      forM_ kpts $ \kpt -> do
        let kptRec = keyPointAsRec kpt
        circle imgM (round <$> kptPoint kptRec :: V2 Int32) 5 blue 1 LineType_AA 0
  where
    surf = mkSurf defaultSurfParams