-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Haskell binding to OpenCV-3.x -- -- -- This is a Haskell library providing a binding to OpenCV-3.x. It binds -- directly with the C++ API using the inline-c Haskell library. -- -- The library is far from complete but the framework is there to easily -- bind missing functionality. -- -- Note that the OpenCV contrib modules are provided by -- opencv-extra. -- -- Make sure to checkout the opencv-examples. @package opencv @version 0.0.2.1 module OpenCV.Core.Types.Vec data Vec (dim :: Nat) (depth :: *) class IsVec (v :: * -> *) (depth :: *) toVec :: IsVec v depth => v depth -> Vec (VecDim v) depth fromVec :: IsVec v depth => Vec (VecDim v) depth -> v depth toVecIO :: IsVec v depth => v depth -> IO (Vec (VecDim v) depth) type Vec2i = Vec 2 Int32 type Vec2f = Vec 2 CFloat type Vec2d = Vec 2 CDouble type Vec3i = Vec 3 Int32 type Vec3f = Vec 3 CFloat type Vec3d = Vec 3 CDouble type Vec4i = Vec 4 Int32 type Vec4f = Vec 4 CFloat type Vec4d = Vec 4 CDouble instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Vec.Vec4d instance OpenCV.Internal.Core.Types.Vec.IsVec (OpenCV.Internal.Core.Types.Vec.Vec 4) Foreign.C.Types.CDouble instance OpenCV.Internal.Core.Types.Vec.IsVec Linear.V4.V4 Foreign.C.Types.CDouble instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Vec4d instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Vec.Vec4f instance OpenCV.Internal.Core.Types.Vec.IsVec (OpenCV.Internal.Core.Types.Vec.Vec 4) Foreign.C.Types.CFloat instance OpenCV.Internal.Core.Types.Vec.IsVec Linear.V4.V4 Foreign.C.Types.CFloat instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Vec4f instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Vec.Vec4i instance OpenCV.Internal.Core.Types.Vec.IsVec (OpenCV.Internal.Core.Types.Vec.Vec 4) GHC.Int.Int32 instance OpenCV.Internal.Core.Types.Vec.IsVec Linear.V4.V4 GHC.Int.Int32 instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Vec4i instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Vec.Vec3d instance OpenCV.Internal.Core.Types.Vec.IsVec (OpenCV.Internal.Core.Types.Vec.Vec 3) Foreign.C.Types.CDouble instance OpenCV.Internal.Core.Types.Vec.IsVec Linear.V3.V3 Foreign.C.Types.CDouble instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Vec3d instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Vec.Vec3f instance OpenCV.Internal.Core.Types.Vec.IsVec (OpenCV.Internal.Core.Types.Vec.Vec 3) Foreign.C.Types.CFloat instance OpenCV.Internal.Core.Types.Vec.IsVec Linear.V3.V3 Foreign.C.Types.CFloat instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Vec3f instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Vec.Vec3i instance OpenCV.Internal.Core.Types.Vec.IsVec (OpenCV.Internal.Core.Types.Vec.Vec 3) GHC.Int.Int32 instance OpenCV.Internal.Core.Types.Vec.IsVec Linear.V3.V3 GHC.Int.Int32 instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Vec3i instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Vec.Vec2d instance OpenCV.Internal.Core.Types.Vec.IsVec (OpenCV.Internal.Core.Types.Vec.Vec 2) Foreign.C.Types.CDouble instance OpenCV.Internal.Core.Types.Vec.IsVec Linear.V2.V2 Foreign.C.Types.CDouble instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Vec2d instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Vec.Vec2f instance OpenCV.Internal.Core.Types.Vec.IsVec (OpenCV.Internal.Core.Types.Vec.Vec 2) Foreign.C.Types.CFloat instance OpenCV.Internal.Core.Types.Vec.IsVec Linear.V2.V2 Foreign.C.Types.CFloat instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Vec2f instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Vec.Vec2i instance OpenCV.Internal.Core.Types.Vec.IsVec (OpenCV.Internal.Core.Types.Vec.Vec 2) GHC.Int.Int32 instance OpenCV.Internal.Core.Types.Vec.IsVec Linear.V2.V2 GHC.Int.Int32 instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Vec2i module OpenCV.Core.Types.Size data Size (depth :: *) class IsSize (p :: * -> *) (depth :: *) toSize :: IsSize p depth => p depth -> Size depth fromSize :: IsSize p depth => Size depth -> p depth toSizeIO :: IsSize p depth => p depth -> IO (Size depth) type Size2i = Size Int32 type Size2f = Size CFloat type Size2d = Size CDouble instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Size.Size2d instance OpenCV.Internal.Core.Types.Size.IsSize OpenCV.Internal.Core.Types.Size.Size Foreign.C.Types.CDouble instance OpenCV.Internal.Core.Types.Size.IsSize Linear.V2.V2 Foreign.C.Types.CDouble instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Size2d instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Size.Size2f instance OpenCV.Internal.Core.Types.Size.IsSize OpenCV.Internal.Core.Types.Size.Size Foreign.C.Types.CFloat instance OpenCV.Internal.Core.Types.Size.IsSize Linear.V2.V2 Foreign.C.Types.CFloat instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Size2f instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Size.Size2i instance OpenCV.Internal.Core.Types.Size.IsSize OpenCV.Internal.Core.Types.Size.Size GHC.Int.Int32 instance OpenCV.Internal.Core.Types.Size.IsSize Linear.V2.V2 GHC.Int.Int32 instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Size2i module OpenCV.Core.Types.Point data Point (dim :: Nat) (depth :: *) class IsPoint (p :: * -> *) (depth :: *) toPoint :: IsPoint p depth => p depth -> Point (PointDim p) depth fromPoint :: IsPoint p depth => Point (PointDim p) depth -> p depth toPointIO :: IsPoint p depth => p depth -> IO (Point (PointDim p) depth) type IsPoint2 p depth = (IsPoint p depth, PointDim p ~ 2) type IsPoint3 p depth = (IsPoint p depth, PointDim p ~ 3) type Point2i = Point 2 Int32 type Point2f = Point 2 CFloat type Point2d = Point 2 CDouble type Point3i = Point 3 Int32 type Point3f = Point 3 CFloat type Point3d = Point 3 CDouble instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Point.Point3d instance OpenCV.Internal.Core.Types.Point.IsPoint (OpenCV.Internal.Core.Types.Point.Point 3) Foreign.C.Types.CDouble instance OpenCV.Internal.Core.Types.Point.IsPoint Linear.V3.V3 Foreign.C.Types.CDouble instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Point3d instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Point.Point3f instance OpenCV.Internal.Core.Types.Point.IsPoint (OpenCV.Internal.Core.Types.Point.Point 3) Foreign.C.Types.CFloat instance OpenCV.Internal.Core.Types.Point.IsPoint Linear.V3.V3 Foreign.C.Types.CFloat instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Point3f instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Point.Point3i instance OpenCV.Internal.Core.Types.Point.IsPoint (OpenCV.Internal.Core.Types.Point.Point 3) GHC.Int.Int32 instance OpenCV.Internal.Core.Types.Point.IsPoint Linear.V3.V3 GHC.Int.Int32 instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Point3i instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Point.Point2d instance OpenCV.Internal.Core.Types.Point.IsPoint (OpenCV.Internal.Core.Types.Point.Point 2) Foreign.C.Types.CDouble instance OpenCV.Internal.Core.Types.Point.IsPoint Linear.V2.V2 Foreign.C.Types.CDouble instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Point2d instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Point.Point2f instance OpenCV.Internal.Core.Types.Point.IsPoint (OpenCV.Internal.Core.Types.Point.Point 2) Foreign.C.Types.CFloat instance OpenCV.Internal.Core.Types.Point.IsPoint Linear.V2.V2 Foreign.C.Types.CFloat instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Point2f instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Point.Point2i instance OpenCV.Internal.Core.Types.Point.IsPoint (OpenCV.Internal.Core.Types.Point.Point 2) GHC.Int.Int32 instance OpenCV.Internal.Core.Types.Point.IsPoint Linear.V2.V2 GHC.Int.Int32 instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Point2i module OpenCV.Core.Types.Rect data Rect (depth :: *) -- | Native Haskell represenation of a rectangle. data HRect a HRect :: !(V2 a) -> !(V2 a) -> HRect a [hRectTopLeft] :: HRect a -> !(V2 a) [hRectSize] :: HRect a -> !(V2 a) class IsRect (r :: * -> *) (depth :: *) toRect :: IsRect r depth => r depth -> Rect depth fromRect :: IsRect r depth => Rect depth -> r depth toRectIO :: IsRect r depth => r depth -> IO (Rect depth) rectTopLeft :: IsRect r depth => r depth -> RectPoint r depth rectBottomRight :: IsRect r depth => r depth -> RectPoint r depth rectSize :: IsRect r depth => r depth -> RectSize r depth rectArea :: IsRect r depth => r depth -> depth rectContains :: IsRect r depth => RectPoint r depth -> r depth -> Bool type Rect2i = Rect Int32 type Rect2f = Rect CFloat type Rect2d = Rect CDouble fmapRect :: forall a b. (IsRect Rect a, IsRect HRect a, IsRect Rect b, IsRect HRect b) => (a -> b) -> Rect a -> Rect b instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Rect.Rect2d instance OpenCV.Internal.Core.Types.Rect.IsRect OpenCV.Internal.Core.Types.Rect.Rect Foreign.C.Types.CDouble instance OpenCV.Internal.Core.Types.Rect.IsRect OpenCV.Internal.Core.Types.Rect.HRect Foreign.C.Types.CDouble instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Rect2d instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Rect.Rect2f instance OpenCV.Internal.Core.Types.Rect.IsRect OpenCV.Internal.Core.Types.Rect.Rect Foreign.C.Types.CFloat instance OpenCV.Internal.Core.Types.Rect.IsRect OpenCV.Internal.Core.Types.Rect.HRect Foreign.C.Types.CFloat instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Rect2f instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Rect.Rect2i instance OpenCV.Internal.Core.Types.Rect.IsRect OpenCV.Internal.Core.Types.Rect.Rect GHC.Int.Int32 instance OpenCV.Internal.Core.Types.Rect.IsRect OpenCV.Internal.Core.Types.Rect.HRect GHC.Int.Int32 instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Rect2i module OpenCV.Core.Types.Matx data Matx (dimR :: Nat) (dimC :: Nat) (depth :: *) class IsMatx (m :: * -> *) depth toMatx :: IsMatx m depth => m depth -> Matx (MatxDimR m) (MatxDimC m) depth fromMatx :: IsMatx m depth => Matx (MatxDimR m) (MatxDimC m) depth -> m depth toMatxIO :: IsMatx m depth => m depth -> IO (Matx (MatxDimR m) (MatxDimC m) depth) type Matx12f = Matx 1 2 CFloat type Matx12d = Matx 1 2 CDouble type Matx13f = Matx 1 3 CFloat type Matx13d = Matx 1 3 CDouble type Matx14f = Matx 1 4 CFloat type Matx14d = Matx 1 4 CDouble type Matx16f = Matx 1 6 CFloat type Matx16d = Matx 1 6 CDouble type Matx21f = Matx 2 1 CFloat type Matx21d = Matx 2 1 CDouble type Matx22f = Matx 2 2 CFloat type Matx22d = Matx 2 2 CDouble type Matx23f = Matx 2 3 CFloat type Matx23d = Matx 2 3 CDouble type Matx31f = Matx 3 1 CFloat type Matx31d = Matx 3 1 CDouble type Matx32f = Matx 3 2 CFloat type Matx32d = Matx 3 2 CDouble type Matx33f = Matx 3 3 CFloat type Matx33d = Matx 3 3 CDouble type Matx34f = Matx 3 4 CFloat type Matx34d = Matx 3 4 CDouble type Matx41f = Matx 4 1 CFloat type Matx41d = Matx 4 1 CDouble type Matx43f = Matx 4 3 CFloat type Matx43d = Matx 4 3 CDouble type Matx44f = Matx 4 4 CFloat type Matx44d = Matx 4 4 CDouble type Matx51f = Matx 5 1 CFloat type Matx51d = Matx 5 1 CDouble type Matx61f = Matx 6 1 CFloat type Matx61d = Matx 6 1 CDouble type Matx66f = Matx 6 6 CFloat type Matx66d = Matx 6 6 CDouble newMatx12f :: CFloat -> CFloat -> IO Matx12f newMatx12d :: CDouble -> CDouble -> IO Matx12d newMatx13f :: CFloat -> CFloat -> CFloat -> IO Matx13f newMatx13d :: CDouble -> CDouble -> CDouble -> IO Matx13d newMatx14f :: CFloat -> CFloat -> CFloat -> CFloat -> IO Matx14f newMatx14d :: CDouble -> CDouble -> CDouble -> CDouble -> IO Matx14d newMatx16f :: CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> IO Matx16f newMatx16d :: CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> IO Matx16d newMatx21f :: CFloat -> CFloat -> IO Matx21f newMatx21d :: CDouble -> CDouble -> IO Matx21d newMatx22f :: CFloat -> CFloat -> CFloat -> CFloat -> IO Matx22f newMatx22d :: CDouble -> CDouble -> CDouble -> CDouble -> IO Matx22d newMatx23f :: CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> IO Matx23f newMatx23d :: CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> IO Matx23d newMatx31f :: CFloat -> CFloat -> CFloat -> IO Matx31f newMatx31d :: CDouble -> CDouble -> CDouble -> IO Matx31d newMatx32f :: CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> IO Matx32f newMatx32d :: CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> IO Matx32d newMatx33f :: CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> IO Matx33f newMatx33d :: CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> IO Matx33d newMatx34f :: CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> IO Matx34f newMatx34d :: CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> IO Matx34d newMatx41f :: CFloat -> CFloat -> CFloat -> CFloat -> IO Matx41f newMatx41d :: CDouble -> CDouble -> CDouble -> CDouble -> IO Matx41d newMatx43f :: CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> IO Matx43f newMatx43d :: CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> IO Matx43d newMatx44f :: CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> IO Matx44f newMatx44d :: CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> IO Matx44d newMatx51f :: CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> IO Matx51f newMatx51d :: CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> IO Matx51d newMatx61f :: CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> IO Matx61f newMatx61d :: CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> CDouble -> IO Matx61d instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Matx.Matx66d instance OpenCV.Internal.Core.Types.Matx.IsMatx (OpenCV.Internal.Core.Types.Matx.Matx 6 6) Foreign.C.Types.CDouble instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Matx66d instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Matx.Matx66f instance OpenCV.Internal.Core.Types.Matx.IsMatx (OpenCV.Internal.Core.Types.Matx.Matx 6 6) Foreign.C.Types.CFloat instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Matx66f instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Matx.Matx61d instance OpenCV.Internal.Core.Types.Matx.IsMatx (OpenCV.Internal.Core.Types.Matx.Matx 6 1) Foreign.C.Types.CDouble instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Matx61d instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Matx.Matx61f instance OpenCV.Internal.Core.Types.Matx.IsMatx (OpenCV.Internal.Core.Types.Matx.Matx 6 1) Foreign.C.Types.CFloat instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Matx61f instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Matx.Matx51d instance OpenCV.Internal.Core.Types.Matx.IsMatx (OpenCV.Internal.Core.Types.Matx.Matx 5 1) Foreign.C.Types.CDouble instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Matx51d instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Matx.Matx51f instance OpenCV.Internal.Core.Types.Matx.IsMatx (OpenCV.Internal.Core.Types.Matx.Matx 5 1) Foreign.C.Types.CFloat instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Matx51f instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Matx.Matx44d instance OpenCV.Internal.Core.Types.Matx.IsMatx (OpenCV.Internal.Core.Types.Matx.Matx 4 4) Foreign.C.Types.CDouble instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Matx44d instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Matx.Matx44f instance OpenCV.Internal.Core.Types.Matx.IsMatx (OpenCV.Internal.Core.Types.Matx.Matx 4 4) Foreign.C.Types.CFloat instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Matx44f instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Matx.Matx43d instance OpenCV.Internal.Core.Types.Matx.IsMatx (OpenCV.Internal.Core.Types.Matx.Matx 4 3) Foreign.C.Types.CDouble instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Matx43d instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Matx.Matx43f instance OpenCV.Internal.Core.Types.Matx.IsMatx (OpenCV.Internal.Core.Types.Matx.Matx 4 3) Foreign.C.Types.CFloat instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Matx43f instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Matx.Matx41d instance OpenCV.Internal.Core.Types.Matx.IsMatx (OpenCV.Internal.Core.Types.Matx.Matx 4 1) Foreign.C.Types.CDouble instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Matx41d instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Matx.Matx41f instance OpenCV.Internal.Core.Types.Matx.IsMatx (OpenCV.Internal.Core.Types.Matx.Matx 4 1) Foreign.C.Types.CFloat instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Matx41f instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Matx.Matx34d instance OpenCV.Internal.Core.Types.Matx.IsMatx (OpenCV.Internal.Core.Types.Matx.Matx 3 4) Foreign.C.Types.CDouble instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Matx34d instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Matx.Matx34f instance OpenCV.Internal.Core.Types.Matx.IsMatx (OpenCV.Internal.Core.Types.Matx.Matx 3 4) Foreign.C.Types.CFloat instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Matx34f instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Matx.Matx33d instance OpenCV.Internal.Core.Types.Matx.IsMatx (OpenCV.Internal.Core.Types.Matx.Matx 3 3) Foreign.C.Types.CDouble instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Matx33d instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Matx.Matx33f instance OpenCV.Internal.Core.Types.Matx.IsMatx (OpenCV.Internal.Core.Types.Matx.Matx 3 3) Foreign.C.Types.CFloat instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Matx33f instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Matx.Matx32d instance OpenCV.Internal.Core.Types.Matx.IsMatx (OpenCV.Internal.Core.Types.Matx.Matx 3 2) Foreign.C.Types.CDouble instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Matx32d instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Matx.Matx32f instance OpenCV.Internal.Core.Types.Matx.IsMatx (OpenCV.Internal.Core.Types.Matx.Matx 3 2) Foreign.C.Types.CFloat instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Matx32f instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Matx.Matx31d instance OpenCV.Internal.Core.Types.Matx.IsMatx (OpenCV.Internal.Core.Types.Matx.Matx 3 1) Foreign.C.Types.CDouble instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Matx31d instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Matx.Matx31f instance OpenCV.Internal.Core.Types.Matx.IsMatx (OpenCV.Internal.Core.Types.Matx.Matx 3 1) Foreign.C.Types.CFloat instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Matx31f instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Matx.Matx23d instance OpenCV.Internal.Core.Types.Matx.IsMatx (OpenCV.Internal.Core.Types.Matx.Matx 2 3) Foreign.C.Types.CDouble instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Matx23d instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Matx.Matx23f instance OpenCV.Internal.Core.Types.Matx.IsMatx (OpenCV.Internal.Core.Types.Matx.Matx 2 3) Foreign.C.Types.CFloat instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Matx23f instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Matx.Matx22d instance OpenCV.Internal.Core.Types.Matx.IsMatx (OpenCV.Internal.Core.Types.Matx.Matx 2 2) Foreign.C.Types.CDouble instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Matx22d instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Matx.Matx22f instance OpenCV.Internal.Core.Types.Matx.IsMatx (OpenCV.Internal.Core.Types.Matx.Matx 2 2) Foreign.C.Types.CFloat instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Matx22f instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Matx.Matx21d instance OpenCV.Internal.Core.Types.Matx.IsMatx (OpenCV.Internal.Core.Types.Matx.Matx 2 1) Foreign.C.Types.CDouble instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Matx21d instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Matx.Matx21f instance OpenCV.Internal.Core.Types.Matx.IsMatx (OpenCV.Internal.Core.Types.Matx.Matx 2 1) Foreign.C.Types.CFloat instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Matx21f instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Matx.Matx16d instance OpenCV.Internal.Core.Types.Matx.IsMatx (OpenCV.Internal.Core.Types.Matx.Matx 1 6) Foreign.C.Types.CDouble instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Matx16d instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Matx.Matx16f instance OpenCV.Internal.Core.Types.Matx.IsMatx (OpenCV.Internal.Core.Types.Matx.Matx 1 6) Foreign.C.Types.CFloat instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Matx16f instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Matx.Matx14d instance OpenCV.Internal.Core.Types.Matx.IsMatx (OpenCV.Internal.Core.Types.Matx.Matx 1 4) Foreign.C.Types.CDouble instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Matx14d instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Matx.Matx14f instance OpenCV.Internal.Core.Types.Matx.IsMatx (OpenCV.Internal.Core.Types.Matx.Matx 1 4) Foreign.C.Types.CFloat instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Matx14f instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Matx.Matx13d instance OpenCV.Internal.Core.Types.Matx.IsMatx (OpenCV.Internal.Core.Types.Matx.Matx 1 3) Foreign.C.Types.CDouble instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Matx13d instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Matx.Matx13f instance OpenCV.Internal.Core.Types.Matx.IsMatx (OpenCV.Internal.Core.Types.Matx.Matx 1 3) Foreign.C.Types.CFloat instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Matx13f instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Matx.Matx12d instance OpenCV.Internal.Core.Types.Matx.IsMatx (OpenCV.Internal.Core.Types.Matx.Matx 1 2) Foreign.C.Types.CDouble instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Matx12d instance OpenCV.Internal.C.Types.FromPtr OpenCV.Core.Types.Matx.Matx12f instance OpenCV.Internal.Core.Types.Matx.IsMatx (OpenCV.Internal.Core.Types.Matx.Matx 1 2) Foreign.C.Types.CFloat instance OpenCV.Internal.C.PlacementNew.PlacementNew OpenCV.Internal.C.Types.C'Matx12f module OpenCV.TypeLevel -- | Dynamically or Statically known values -- -- Mainly used as a promoted type. -- -- Operationally exactly the Maybe type data DS a -- | Something is dynamically known D :: DS a -- | Something is statically known, in particular: a S :: a -> DS a -- | Converts a DS value to the corresponding Maybe value dsToMaybe :: DS a -> Maybe a -- | End of list data Z Z :: Z -- | Heterogeneous lists -- -- Implemented as nested 2-tuples. -- --
-- f :: Int ::: Bool ::: Char ::: Z -- f = 3 ::: False ::: 'X' ::: Z --data a (:::) b (:::) :: a -> b -> (:::) a b class ToInt32 a toInt32 :: ToInt32 a => a -> Int32 -- | Type level to value level conversion of numbers that are either -- Dynamically or Statically known. -- --
-- toNatDS (Proxy ('S 42)) == S 42
-- toNatDS (Proxy 'D) == D
--
class ToNatDS a
toNatDS :: ToNatDS a => a -> DS Int32
class ToNatListDS a
toNatListDS :: ToNatListDS a => a -> [DS Int32]
type In e xs = Elem e xs ~ 'True
type MayRelax a b = Relax a b ~ 'True
class All (p :: k -> Constraint) (xs :: [k])
class (PrivateIsStatic ds) => IsStatic (ds :: DS a)
instance GHC.Base.Functor OpenCV.TypeLevel.DS
instance GHC.Classes.Eq a => GHC.Classes.Eq (OpenCV.TypeLevel.DS a)
instance GHC.Show.Show a => GHC.Show.Show (OpenCV.TypeLevel.DS a)
instance forall a1 (a2 :: a1). OpenCV.TypeLevel.IsStatic ('OpenCV.TypeLevel.S a2)
instance forall k (p :: k -> GHC.Types.Constraint). OpenCV.TypeLevel.All p '[]
instance forall a (p :: a -> GHC.Types.Constraint) (x :: a) (xs :: [a]). (p x, OpenCV.TypeLevel.All p xs) => OpenCV.TypeLevel.All p (x : xs)
instance forall a1 (a2 :: a1). OpenCV.TypeLevel.PrivateIsStatic ('OpenCV.TypeLevel.S a2)
instance forall k (proxy :: [k] -> *). OpenCV.TypeLevel.ToNatListDS (proxy '[])
instance forall a1 (a2 :: a1) (as :: [a1]). (OpenCV.TypeLevel.ToNatDS (Data.Proxy.Proxy a2), OpenCV.TypeLevel.ToNatListDS (Data.Proxy.Proxy as)) => OpenCV.TypeLevel.ToNatListDS (Data.Proxy.Proxy (a2 : as))
instance forall a (proxy :: OpenCV.TypeLevel.DS a -> *). OpenCV.TypeLevel.ToNatDS (proxy 'OpenCV.TypeLevel.D)
instance forall a (n :: a). OpenCV.TypeLevel.ToInt32 (Data.Proxy.Proxy n) => OpenCV.TypeLevel.ToNatDS (Data.Proxy.Proxy ('OpenCV.TypeLevel.S n))
instance OpenCV.TypeLevel.ToInt32 GHC.Int.Int32
instance GHC.TypeNats.KnownNat n => OpenCV.TypeLevel.ToInt32 (proxy n)
module OpenCV.ImgProc.MiscImgTransform.ColorCodes
-- | Valid color conversions described by the following graph:
--
class ColorConversion (fromColor :: ColorCode) (toColor :: ColorCode)
-- | Names of color encodings
data ColorCode
-- | (bayerBG) Bayer pattern with BG in the second row, second and
-- third column
BayerBG :: ColorCode
-- | (bayerGB) Bayer pattern with GB in the second row, second and
-- third column
BayerGB :: ColorCode
-- | (bayerGR) Bayer pattern with GR in the second row, second and
-- third column
BayerGR :: ColorCode
-- | (bayerRG) Bayer pattern with RG in the second row, second and
-- third column
BayerRG :: ColorCode
-- | (bgr) 24 bit RGB color space with channels: (B8:G8:R8)
BGR :: ColorCode
-- | (bgr555) 15 bit RGB color space
BGR555 :: ColorCode
-- | (bgr565) 16 bit RGB color space
BGR565 :: ColorCode
-- | (bgra) 32 bit RGBA color space with channels: (B8:G8:R8:A8)
BGRA :: ColorCode
-- | (bgra_I420)
BGRA_I420 :: ColorCode
-- | (bgra_IYUV)
BGRA_IYUV :: ColorCode
-- | (bgra_NV12)
BGRA_NV12 :: ColorCode
-- | (bgra_NV21)
BGRA_NV21 :: ColorCode
-- | (bgra_UYNV)
BGRA_UYNV :: ColorCode
-- | (bgra_UYVY)
BGRA_UYVY :: ColorCode
-- | (bgra_Y422)
BGRA_Y422 :: ColorCode
-- | (bgra_YUNV)
BGRA_YUNV :: ColorCode
-- | (bgra_YUY2)
BGRA_YUY2 :: ColorCode
-- | (bgra_YUYV)
BGRA_YUYV :: ColorCode
-- | (bgra_YV12)
BGRA_YV12 :: ColorCode
-- | (bgra_YVYU)
BGRA_YVYU :: ColorCode
-- | (bgr_EA) Edge-Aware
BGR_EA :: ColorCode
-- | (bgr_FULL)
BGR_FULL :: ColorCode
-- | (bgr_I420)
BGR_I420 :: ColorCode
-- | (bgr_IYUV)
BGR_IYUV :: ColorCode
-- | (bgr_NV12)
BGR_NV12 :: ColorCode
-- | (bgr_NV21)
BGR_NV21 :: ColorCode
-- | (bgr_UYNV)
BGR_UYNV :: ColorCode
-- | (bgr_UYVY)
BGR_UYVY :: ColorCode
-- | (bgr_VNG)
BGR_VNG :: ColorCode
-- | (bgr_Y422)
BGR_Y422 :: ColorCode
-- | (bgr_YUNV)
BGR_YUNV :: ColorCode
-- | (bgr_YUY2)
BGR_YUY2 :: ColorCode
-- | (bgr_YUYV)
BGR_YUYV :: ColorCode
-- | (bgr_YV12)
BGR_YV12 :: ColorCode
-- | (bgr_YVYU)
BGR_YVYU :: ColorCode
-- | (gray) 8 bit single channel color space
GRAY :: ColorCode
-- | (gray_420)
GRAY_420 :: ColorCode
-- | (gray_I420)
GRAY_I420 :: ColorCode
-- | (gray_IYUV)
GRAY_IYUV :: ColorCode
-- | (gray_NV12)
GRAY_NV12 :: ColorCode
-- | (gray_NV21)
GRAY_NV21 :: ColorCode
-- | (gray_UYNV)
GRAY_UYNV :: ColorCode
-- | (gray_UYVY)
GRAY_UYVY :: ColorCode
-- | (gray_Y422)
GRAY_Y422 :: ColorCode
-- | (gray_YUNV)
GRAY_YUNV :: ColorCode
-- | (gray_YUY2)
GRAY_YUY2 :: ColorCode
-- | (gray_YUYV)
GRAY_YUYV :: ColorCode
-- | (gray_YV12)
GRAY_YV12 :: ColorCode
-- | (gray_YVYU)
GRAY_YVYU :: ColorCode
-- | (hls)
HLS :: ColorCode
-- | (hls_FULL)
HLS_FULL :: ColorCode
-- | (hsv)
HSV :: ColorCode
-- | (hsv_FULL)
HSV_FULL :: ColorCode
-- | (lab)
Lab :: ColorCode
-- | (lbgr)
LBGR :: ColorCode
-- | (lrgb)
LRGB :: ColorCode
-- | (luv)
Luv :: ColorCode
-- | (mrgba)
MRGBA :: ColorCode
-- | (rgb) 24 bit RGB color space with channels: (R8:G8:B8)
RGB :: ColorCode
-- | (rgba)
RGBA :: ColorCode
-- | (rgba_I420)
RGBA_I420 :: ColorCode
-- | (rgba_IYUV)
RGBA_IYUV :: ColorCode
-- | (rgba_NV12)
RGBA_NV12 :: ColorCode
-- | (rgba_NV21)
RGBA_NV21 :: ColorCode
-- | (rgba_UYNV)
RGBA_UYNV :: ColorCode
-- | (rgba_UYVY)
RGBA_UYVY :: ColorCode
-- | (rgba_Y422)
RGBA_Y422 :: ColorCode
-- | (rgba_YUNV)
RGBA_YUNV :: ColorCode
-- | (rgba_YUY2)
RGBA_YUY2 :: ColorCode
-- | (rgba_YUYV)
RGBA_YUYV :: ColorCode
-- | (rgba_YV12)
RGBA_YV12 :: ColorCode
-- | (rgba_YVYU)
RGBA_YVYU :: ColorCode
-- | (rgb_EA) Edge-Aware
RGB_EA :: ColorCode
-- | (rgb_FULL)
RGB_FULL :: ColorCode
-- | (rgb_I420)
RGB_I420 :: ColorCode
-- | (rgb_IYUV)
RGB_IYUV :: ColorCode
-- | (rgb_NV12)
RGB_NV12 :: ColorCode
-- | (rgb_NV21)
RGB_NV21 :: ColorCode
-- | (rgb_UYNV)
RGB_UYNV :: ColorCode
-- | (rgb_UYVY)
RGB_UYVY :: ColorCode
-- | (rgb_VNG)
RGB_VNG :: ColorCode
-- | (rgb_Y422)
RGB_Y422 :: ColorCode
-- | (rgb_YUNV)
RGB_YUNV :: ColorCode
-- | (rgb_YUY2)
RGB_YUY2 :: ColorCode
-- | (rgb_YUYV)
RGB_YUYV :: ColorCode
-- | (rgb_YV12)
RGB_YV12 :: ColorCode
-- | (rgb_YVYU)
RGB_YVYU :: ColorCode
-- | (xyz)
XYZ :: ColorCode
-- | (yCrCb)
YCrCb :: ColorCode
-- | (yuv)
YUV :: ColorCode
-- | (yuv420p)
YUV420p :: ColorCode
-- | (yuv420sp)
YUV420sp :: ColorCode
-- | (yuv_I420)
YUV_I420 :: ColorCode
-- | (yuv_IYUV)
YUV_IYUV :: ColorCode
-- | (yuv_YV12)
YUV_YV12 :: ColorCode
-- | Gives the number of channels associated with a particular color
-- encoding
class ColorCodeMatchesChannels (code :: ColorCode) (channels :: DS Nat)
bayerBG :: Proxy 'BayerBG
bayerGB :: Proxy 'BayerGB
bayerGR :: Proxy 'BayerGR
bayerRG :: Proxy 'BayerRG
bgr :: Proxy 'BGR
bgr555 :: Proxy 'BGR555
bgr565 :: Proxy 'BGR565
bgra :: Proxy 'BGRA
bgra_I420 :: Proxy 'BGRA_I420
bgra_IYUV :: Proxy 'BGRA_IYUV
bgra_NV12 :: Proxy 'BGRA_NV12
bgra_NV21 :: Proxy 'BGRA_NV21
bgra_UYNV :: Proxy 'BGRA_UYNV
bgra_UYVY :: Proxy 'BGRA_UYVY
bgra_Y422 :: Proxy 'BGRA_Y422
bgra_YUNV :: Proxy 'BGRA_YUNV
bgra_YUY2 :: Proxy 'BGRA_YUY2
bgra_YUYV :: Proxy 'BGRA_YUYV
bgra_YV12 :: Proxy 'BGRA_YV12
bgra_YVYU :: Proxy 'BGRA_YVYU
bgr_EA :: Proxy 'BGR_EA
bgr_FULL :: Proxy 'BGR_FULL
bgr_I420 :: Proxy 'BGR_I420
bgr_IYUV :: Proxy 'BGR_IYUV
bgr_NV12 :: Proxy 'BGR_NV12
bgr_NV21 :: Proxy 'BGR_NV21
bgr_UYNV :: Proxy 'BGR_UYNV
bgr_UYVY :: Proxy 'BGR_UYVY
bgr_VNG :: Proxy 'BGR_VNG
bgr_Y422 :: Proxy 'BGR_Y422
bgr_YUNV :: Proxy 'BGR_YUNV
bgr_YUY2 :: Proxy 'BGR_YUY2
bgr_YUYV :: Proxy 'BGR_YUYV
bgr_YV12 :: Proxy 'BGR_YV12
bgr_YVYU :: Proxy 'BGR_YVYU
gray :: Proxy 'GRAY
gray_420 :: Proxy 'GRAY_420
gray_I420 :: Proxy 'GRAY_I420
gray_IYUV :: Proxy 'GRAY_IYUV
gray_NV12 :: Proxy 'GRAY_NV12
gray_NV21 :: Proxy 'GRAY_NV21
gray_UYNV :: Proxy 'GRAY_UYNV
gray_UYVY :: Proxy 'GRAY_UYVY
gray_Y422 :: Proxy 'GRAY_Y422
gray_YUNV :: Proxy 'GRAY_YUNV
gray_YUY2 :: Proxy 'GRAY_YUY2
gray_YUYV :: Proxy 'GRAY_YUYV
gray_YV12 :: Proxy 'GRAY_YV12
gray_YVYU :: Proxy 'GRAY_YVYU
hls :: Proxy 'HLS
hls_FULL :: Proxy 'HLS_FULL
hsv :: Proxy 'HSV
hsv_FULL :: Proxy 'HSV_FULL
lab :: Proxy 'Lab
lbgr :: Proxy 'LBGR
lrgb :: Proxy 'LRGB
luv :: Proxy 'Luv
mrgba :: Proxy 'MRGBA
rgb :: Proxy 'RGB
rgba :: Proxy 'RGBA
rgba_I420 :: Proxy 'RGBA_I420
rgba_IYUV :: Proxy 'RGBA_IYUV
rgba_NV12 :: Proxy 'RGBA_NV12
rgba_NV21 :: Proxy 'RGBA_NV21
rgba_UYNV :: Proxy 'RGBA_UYNV
rgba_UYVY :: Proxy 'RGBA_UYVY
rgba_Y422 :: Proxy 'RGBA_Y422
rgba_YUNV :: Proxy 'RGBA_YUNV
rgba_YUY2 :: Proxy 'RGBA_YUY2
rgba_YUYV :: Proxy 'RGBA_YUYV
rgba_YV12 :: Proxy 'RGBA_YV12
rgba_YVYU :: Proxy 'RGBA_YVYU
rgb_EA :: Proxy 'RGB_EA
rgb_FULL :: Proxy 'RGB_FULL
rgb_I420 :: Proxy 'RGB_I420
rgb_IYUV :: Proxy 'RGB_IYUV
rgb_NV12 :: Proxy 'RGB_NV12
rgb_NV21 :: Proxy 'RGB_NV21
rgb_UYNV :: Proxy 'RGB_UYNV
rgb_UYVY :: Proxy 'RGB_UYVY
rgb_VNG :: Proxy 'RGB_VNG
rgb_Y422 :: Proxy 'RGB_Y422
rgb_YUNV :: Proxy 'RGB_YUNV
rgb_YUY2 :: Proxy 'RGB_YUY2
rgb_YUYV :: Proxy 'RGB_YUYV
rgb_YV12 :: Proxy 'RGB_YV12
rgb_YVYU :: Proxy 'RGB_YVYU
xyz :: Proxy 'XYZ
yCrCb :: Proxy 'YCrCb
yuv :: Proxy 'YUV
yuv420p :: Proxy 'YUV420p
yuv420sp :: Proxy 'YUV420sp
yuv_I420 :: Proxy 'YUV_I420
yuv_IYUV :: Proxy 'YUV_IYUV
yuv_YV12 :: Proxy 'YUV_YV12
module OpenCV.Exception
data CvException
BindingException :: !CvCppException -> CvException
CoerceMatError :: ![CoerceMatError] -> CvException
data CoerceMatError
ShapeError :: !(ExpectationError Int) -> CoerceMatError
SizeError :: !Int -> !(ExpectationError Int) -> CoerceMatError
ChannelError :: !(ExpectationError Int) -> CoerceMatError
DepthError :: !(ExpectationError Depth) -> CoerceMatError
data ExpectationError a
ExpectationError :: !a -> !a -> ExpectationError a
[expectedValue] :: ExpectationError a -> !a
[actualValue] :: ExpectationError a -> !a
data CvCppException
type CvExcept a = Except CvException a
type CvExceptT m a = ExceptT CvException m a
pureExcept :: (Applicative m) => CvExcept a -> CvExceptT m a
exceptError :: CvExcept a -> a
exceptErrorIO :: CvExceptT IO a -> IO a
exceptErrorM :: (Monad m) => CvExceptT m a -> m a
module OpenCV.Photo
data InpaintingMethod
-- | Navier-Stokes based method.
InpaintNavierStokes :: InpaintingMethod
-- | Method by Alexandru Telea.
InpaintTelea :: InpaintingMethod
-- | Perform decolor
--
-- Decolor a color image to a grayscale (1 channel) and a color boosted
-- image (3 channel)
--
-- Example:
--
--
-- decolorImg
-- :: forall h h2 w w2 c d
-- . ( Mat (ShapeT [h, w]) ('S c) ('S d) ~ Bikes_512x341
-- , h2 ~ ((*) h 2)
-- , w2 ~ ((*) w 2)
-- )
-- => Mat ('S ['S h2, 'S w2]) ('S c) ('S d)
-- decolorImg = exceptError $ do
-- (bikesGray, boost) <- decolor bikes_512x341
-- colorGray <- cvtColor gray bgr bikesGray
-- withMatM
-- (Proxy :: Proxy [h2, w2])
-- (Proxy :: Proxy c)
-- (Proxy :: Proxy d)
-- white $ \imgM -> do
-- matCopyToM imgM (V2 0 0) bikes_512x341 Nothing
-- matCopyToM imgM (V2 0 h) colorGray Nothing
-- matCopyToM imgM (V2 w h) boost Nothing
-- where
-- w = fromInteger $ natVal (Proxy :: Proxy w)
-- h = fromInteger $ natVal (Proxy :: Proxy h)
--
--
decolor :: Mat ( 'S [h, w]) ( 'S 3) ( 'S Word8) -> CvExcept (Mat ( 'S [h, w]) ( 'S 1) ( 'S Word8), Mat ( 'S [h, w]) ( 'S 3) ( 'S Word8))
-- | Restores the selected region in an image using the region
-- neighborhood.
--
-- Example:
--
--
-- inpaintImg
-- :: forall h h2 w w2 c d
-- . ( Mat (ShapeT [h, w]) ('S c) ('S d) ~ Bikes_512x341
-- , h2 ~ ((*) h 2)
-- , w2 ~ ((*) w 2)
-- )
-- => Mat ('S ['S h2, 'S w2]) ('S c) ('S d)
-- inpaintImg = exceptError $ do
-- maskInv <- bitwiseNot mask
-- maskBgr <- cvtColor gray bgr maskInv
-- damaged <- bitwiseAnd bikes_512x341 maskBgr
-- repairedNS <- inpaint 3 InpaintNavierStokes damaged mask
-- repairedT <- inpaint 3 InpaintTelea damaged mask
-- withMatM
-- (Proxy :: Proxy [h2, w2])
-- (Proxy :: Proxy c)
-- (Proxy :: Proxy d)
-- black $ \imgM -> do
-- matCopyToM imgM (V2 0 0) damaged Nothing
-- matCopyToM imgM (V2 w 0) maskBgr Nothing
-- matCopyToM imgM (V2 0 h) repairedNS Nothing
-- matCopyToM imgM (V2 w h) repairedT Nothing
-- where
-- mask = damageMask
--
-- w = fromInteger $ natVal (Proxy :: Proxy w)
-- h = fromInteger $ natVal (Proxy :: Proxy h)
--
--
inpaint :: (channels `In` [1, 3]) => Double -> InpaintingMethod -> Mat ( 'S [h, w]) ( 'S channels) ( 'S Word8) -> Mat ( 'S [h, w]) ( 'S 1) ( 'S Word8) -> CvExcept (Mat ( 'S [h, w]) ( 'S channels) ( 'S Word8))
-- | Perform denoise_TVL1
--
-- Example:
--
--
-- denoise_TVL1Img
-- :: forall h w w2 c d
-- . ( Mat (ShapeT [h, w]) ('S c) ('S d) ~ Lenna_512x512
-- , w2 ~ ((*) w 2)
-- )
-- => Mat ('S ['S h, 'S w2]) ('S c) ('S d)
-- denoise_TVL1Img = exceptError $ do
-- denoised <- matChannelMapM (denoise_TVL1 2 50 . V.singleton) lenna_512x512
-- withMatM
-- (Proxy :: Proxy [h, w2])
-- (Proxy :: Proxy c)
-- (Proxy :: Proxy d)
-- black $ \imgM -> do
-- matCopyToM imgM (V2 0 0) lenna_512x512 Nothing
-- matCopyToM imgM (V2 w 0) denoised Nothing
-- where
-- w = fromInteger $ natVal (Proxy :: Proxy w)
--
--
denoise_TVL1 :: Double -> Int32 -> Vector (Mat ( 'S [h, w]) ( 'S 1) ( 'S Word8)) -> CvExcept (Mat ( 'S [h, w]) ( 'S 1) ( 'S Word8))
-- | Perform fastNlMeansDenoising function for colored images. Denoising is
-- not per channel but in a different colour space
--
-- Example:
--
--
-- fastNlMeansDenoisingColoredImg
-- :: forall h w w2 c d
-- . ( Mat (ShapeT [h, w]) ('S c) ('S d) ~ Lenna_512x512
-- , w2 ~ ((*) w 2)
-- )
-- => Mat ('S ['S h, 'S w2]) ('S c) ('S d)
-- fastNlMeansDenoisingColoredImg = exceptError $ do
-- denoised <- fastNlMeansDenoisingColored 3 10 7 21 lenna_512x512
-- withMatM
-- (Proxy :: Proxy [h, w2])
-- (Proxy :: Proxy c)
-- (Proxy :: Proxy d)
-- black $ \imgM -> do
-- matCopyToM imgM (V2 0 0) lenna_512x512 Nothing
-- matCopyToM imgM (V2 w 0) denoised Nothing
-- where
-- w = fromInteger $ natVal (Proxy :: Proxy w)
--
--
fastNlMeansDenoisingColored :: Double -> Double -> Int32 -> Int32 -> Mat ( 'S [h, w]) ( 'S 3) ( 'S Word8) -> CvExcept (Mat ( 'S [h, w]) ( 'S 3) ( 'S Word8))
-- | Perform fastNlMeansDenoisingColoredMulti function for colored images.
-- Denoising is not pre channel but in a different colour space. This
-- wrapper differs from the original OpenCV version by using all input
-- images and denoising the middle one. The original version would allow
-- to have some arbitrary length vector and slide window over it. As we
-- have to copy the haskell vector before we can use it as `std::vector`
-- on the cpp side it is easier to trim the vector before sending and use
-- all frames.
--
-- Example:
--
--
-- fastNlMeansDenoisingColoredMultiImg
-- :: forall h w w2 c d
-- . ( Mat (ShapeT [h, w]) ('S c) ('S d) ~ Lenna_512x512
-- , w2 ~ ((*) w 2)
-- )
-- => Mat ('S ['S h, 'S w2]) ('S c) ('S d)
-- fastNlMeansDenoisingColoredMultiImg = exceptError $ do
-- denoised <- fastNlMeansDenoisingColoredMulti 3 10 7 21 (V.singleton lenna_512x512)
-- withMatM
-- (Proxy :: Proxy [h, w2])
-- (Proxy :: Proxy c)
-- (Proxy :: Proxy d)
-- black $ \imgM -> do
-- matCopyToM imgM (V2 0 0) lenna_512x512 Nothing
-- matCopyToM imgM (V2 w 0) denoised Nothing
-- where
-- w = fromInteger $ natVal (Proxy :: Proxy w)
--
--
fastNlMeansDenoisingColoredMulti :: Double -> Double -> Int32 -> Int32 -> Vector (Mat ( 'S [h, w]) ( 'S 3) ( 'S Word8)) -> CvExcept (Mat ( 'S [h, w]) ( 'S 3) ( 'S Word8))
instance GHC.Show.Show OpenCV.Photo.InpaintingMethod
module OpenCV.Core.Types.Mat.Repa
-- | Representation tag for Repa Arrays for OpenCV
-- Mats.
data M (shape :: [DS Nat]) (channels :: Nat)
-- | Converts an OpenCV Matrix into a Repa array.
--
-- This is a zero-copy operation.
toRepa :: forall (shape :: [DS Nat]) (channels :: Nat) (depth :: *) (dims :: Nat) (sh :: *). (Storable depth, KnownNat channels, KnownNat dims, dims ~ Length shape, sh ~ DIM ((dims + 1))) => Mat ( 'S shape) ( 'S channels) ( 'S depth) -> Array (M shape channels) sh depth
instance (Data.Array.Repa.Shape.Shape sh, Foreign.Storable.Storable depth) => Control.DeepSeq.NFData (Data.Array.Repa.Base.Array (OpenCV.Core.Types.Mat.Repa.M shape channels) sh depth)
instance Foreign.Storable.Storable depth => Data.Array.Repa.Base.Source (OpenCV.Core.Types.Mat.Repa.M shape channels) depth
module OpenCV.Unsafe
unsafeCoerceMat :: Mat shapeIn channelsIn depthIn -> Mat shapeOut channelsOut depthOut
unsafeCoerceMatM :: Mut (Mat shapeIn channelsIn depthIn) s -> Mut (Mat shapeOut channelsOut depthOut) s
unsafeFreeze :: (FreezeThaw a, (PrimMonad m)) => Mutable a (PrimState m) -> m a
unsafeThaw :: (FreezeThaw a, (PrimMonad m)) => a -> m (Mutable a (PrimState m))
unsafeRead :: forall m shape channels depth value. (PrimMonad m, Storable value) => Mut (Mat shape channels depth) (PrimState m) -> [Int] -> Int -> m value
unsafeWrite :: (PrimMonad m, Storable value) => Mut (Mat shape channels depth) (PrimState m) -> [Int] -> Int -> value -> m ()
module OpenCV.Core.Types.Mat
data Mat (shape :: DS [DS Nat]) (channels :: DS Nat) (depth :: DS *)
class ToMat a
toMat :: ToMat a => a -> Mat (MatShape a) (MatChannels a) (MatDepth a)
class FromMat a
fromMat :: FromMat a => Mat (MatShape a) (MatChannels a) (MatDepth a) -> a
-- | Tests whether a Mat is deserving of its type level attributes
--
-- Checks if the properties encoded in the type of a Mat
-- correspond to the value level representation. For each property that
-- does not hold this function will produce an error message. If
-- everything checks out it will produce an empty list.
--
-- The following properties are checked:
--
--
-- matSubRectImg :: Mat ('S ['D, 'D]) ('S 3) ('S Word8)
-- matSubRectImg = exceptError $
-- withMatM (h ::: 2 * w ::: Z)
-- (Proxy :: Proxy 3)
-- (Proxy :: Proxy Word8)
-- white $ \imgM -> do
-- matCopyToM imgM (V2 0 0) birds_512x341 Nothing
-- matCopyToM imgM (V2 w 0) subImg Nothing
-- lift $ rectangle imgM subRect blue 1 LineType_4 0
-- lift $ rectangle imgM (toRect $ HRect (V2 w 0) (V2 w h) :: Rect2i) blue 1 LineType_4 0
-- where
-- subRect = toRect $ HRect (V2 96 131) (V2 90 60)
-- subImg = exceptError $
-- resize (ResizeAbs $ toSize $ V2 w h) InterCubic =<<
-- matSubRect birds_512x341 subRect
-- [h, w] = miShape $ matInfo birds_512x341
--
--
matSubRect :: Mat ( 'S [height, width]) channels depth -> Rect2i -> CvExcept (Mat ( 'S [ 'D, 'D]) channels depth)
matCopyTo :: Mat ( 'S [dstHeight, dstWidth]) channels depth -> V2 Int32 -> Mat ( 'S [srcHeight, srcWidth]) channels depth -> Maybe (Mat ( 'S [srcHeight, srcWidth]) ( 'S 1) ( 'S Word8)) -> CvExcept (Mat ( 'S [dstHeight, dstWidth]) channels depth)
-- | Converts an array to another data type with optional scaling
--
-- OpenCV Sphinx doc
matConvertTo :: forall shape channels srcDepth dstDepth. (ToDepthDS (Proxy dstDepth)) => Maybe Double -> Maybe Double -> Mat shape channels srcDepth -> CvExcept (Mat shape channels dstDepth)
-- | Create a matrix whose elements are defined by a function.
--
-- Example:
--
--
-- matFromFuncImg
-- :: forall size. (size ~ 300)
-- => Mat (ShapeT [size, size]) ('S 4) ('S Word8)
-- matFromFuncImg = exceptError $
-- matFromFunc
-- (Proxy :: Proxy [size, size])
-- (Proxy :: Proxy 4)
-- (Proxy :: Proxy Word8)
-- example
-- where
-- example [y, x] 0 = 255 - normDist (V2 x y ^-^ bluePt )
-- example [y, x] 1 = 255 - normDist (V2 x y ^-^ greenPt)
-- example [y, x] 2 = 255 - normDist (V2 x y ^-^ redPt )
-- example [y, x] 3 = normDist (V2 x y ^-^ alphaPt)
-- example _pos _channel = error "impossible"
--
-- normDist :: V2 Int -> Word8
-- normDist v = floor $ min 255 $ 255 * Linear.norm (fromIntegral <$> v) / s'
--
-- bluePt = V2 0 0
-- greenPt = V2 s s
-- redPt = V2 s 0
-- alphaPt = V2 0 s
--
-- s = fromInteger $ natVal (Proxy :: Proxy size) :: Int
-- s' = fromIntegral s :: Double
--
--
matFromFunc :: forall shape channels depth. (ToShape shape, ToChannels channels, ToDepth depth, Storable (StaticDepthT depth)) => shape -> channels -> depth -> ([Int] -> Int -> StaticDepthT depth) -> CvExcept (Mat (ShapeT shape) (ChannelsT channels) (DepthT depth))
typeCheckMatM :: forall shape channels depth s. (ToShapeDS (Proxy shape), ToChannelsDS (Proxy channels), ToDepthDS (Proxy depth)) => Mut (Mat shape channels depth) s -> [CoerceMatError]
relaxMatM :: (MayRelax shapeIn shapeOut, MayRelax channelsIn channelsOut, MayRelax depthIn depthOut) => Mut (Mat shapeIn channelsIn depthIn) s -> Mut (Mat shapeOut channelsOut depthOut) s
coerceMatM :: (ToShapeDS (Proxy shapeOut), ToChannelsDS (Proxy channelsOut), ToDepthDS (Proxy depthOut)) => Mut (Mat shapeIn channelsIn depthIn) s -> CvExcept (Mut (Mat shapeOut channelsOut depthOut) s)
freeze :: (FreezeThaw a, (PrimMonad m)) => Mutable a (PrimState m) -> m a
thaw :: (FreezeThaw a, (PrimMonad m)) => a -> m (Mutable a (PrimState m))
mkMatM :: (PrimMonad m, ToShape shape, ToChannels channels, ToDepth depth, ToScalar scalar) => shape -> channels -> depth -> scalar -> CvExceptT m (Mut (Mat (ShapeT shape) (ChannelsT channels) (DepthT depth)) (PrimState m))
createMat :: (forall s. CvExceptT (ST s) (Mut (Mat shape channels depth) s)) -> CvExcept (Mat shape channels depth)
withMatM :: (ToShape shape, ToChannels channels, ToDepth depth, ToScalar scalar) => shape -> channels -> depth -> scalar -> (forall s. Mut (Mat (ShapeT shape) (ChannelsT channels) (DepthT depth)) (PrimState (ST s)) -> CvExceptT (ST s) ()) -> CvExcept (Mat (ShapeT shape) (ChannelsT channels) (DepthT depth))
cloneMatM :: (PrimMonad m) => Mat shape channels depth -> m (Mat shape channels depth)
matCopyToM :: (PrimMonad m) => Mut (Mat ( 'S [dstHeight, dstWidth]) channels depth) (PrimState m) -> V2 Int32 -> Mat ( 'S [srcHeight, srcWidth]) channels depth -> Maybe (Mat ( 'S [srcHeight, srcWidth]) ( 'S 1) ( 'S Word8)) -> CvExceptT m ()
class All (p :: k -> Constraint) (xs :: [k])
class (PrivateIsStatic ds) => IsStatic (ds :: DS a)
-- | Transforms a given list of matrices of equal shape, channels, and
-- depth, by folding the given function over all matrix elements at each
-- position.
foldMat :: forall (shape :: [DS Nat]) (channels :: Nat) (depth :: *) a. (Storable depth, Storable a, All IsStatic shape) => (a -> Vector depth -> a) -> a -> [Mat ( 'S shape) ( 'S channels) ( 'S depth)] -> Maybe (Vector a)
data MatInfo
MatInfo :: ![Int32] -> !Depth -> !Int32 -> MatInfo
[miShape] :: MatInfo -> ![Int32]
[miDepth] :: MatInfo -> !Depth
[miChannels] :: MatInfo -> !Int32
matInfo :: Mat shape channels depth -> MatInfo
data Depth
Depth_8U :: Depth
Depth_8S :: Depth
Depth_16U :: Depth
Depth_16S :: Depth
Depth_32S :: Depth
Depth_32F :: Depth
Depth_64F :: Depth
Depth_USRTYPE1 :: Depth
type ChannelsT a = DSNat a
class ToShape a
toShape :: ToShape a => a -> Vector Int32
class ToShapeDS a
toShapeDS :: ToShapeDS a => a -> DS [DS Int32]
type ToChannels a = ToInt32 a
toChannels :: (ToInt32 a) => a -> Int32
type ToChannelsDS a = ToNatDS a
toChannelsDS :: (ToChannelsDS a) => a -> DS Int32
class ToDepth a
toDepth :: ToDepth a => a -> Depth
class ToDepthDS a
toDepthDS :: ToDepthDS a => a -> DS Depth
module OpenCV.ImgCodecs
data ImreadMode
ImreadUnchanged :: ImreadMode
ImreadGrayscale :: ImreadMode
ImreadColor :: ImreadMode
ImreadAnyDepth :: ImreadMode
ImreadAnyColor :: ImreadMode
ImreadLoadGdal :: ImreadMode
-- | Reads an image from a buffer in memory.
--
-- The function reads an image from the specified buffer in the memory.
-- If the buffer is too short or contains invalid data, the empty
-- matrix/image is returned.
--
-- OpenCV Sphinx doc
imdecode :: ImreadMode -> ByteString -> Mat ( 'S [ 'D, 'D]) 'D 'D
imdecodeM :: (PrimMonad m) => ImreadMode -> ByteString -> m (Mut (Mat ( 'S [ 'D, 'D]) 'D 'D) (PrimState m))
data OutputFormat
OutputBmp :: OutputFormat
OutputExr :: OutputFormat
-- | Compression (run length encoding)
OutputHdr :: Bool -> OutputFormat
OutputJpeg :: JpegParams -> OutputFormat
OutputJpeg2000 :: OutputFormat
OutputPng :: PngParams -> OutputFormat
-- | Binary
OutputPxm :: Bool -> OutputFormat
OutputSunras :: OutputFormat
OutputTiff :: OutputFormat
-- | Quality [1..100], > 100 == lossless
OutputWebP :: Int -> OutputFormat
data JpegParams
JpegParams :: Int -> Bool -> Bool -> Word16 -> Int -> Int -> JpegParams
-- | <math>
[jpegParamQuality] :: JpegParams -> Int
[jpegParamProgressive] :: JpegParams -> Bool
[jpegParamOptimize] :: JpegParams -> Bool
[jpegParamRestartInterval] :: JpegParams -> Word16
[jpegParamLumaQuality] :: JpegParams -> Int
[jpegParamChromaQuality] :: JpegParams -> Int
defaultJpegParams :: JpegParams
data PngStrategy
PngStrategyDefault :: PngStrategy
PngStrategyFiltered :: PngStrategy
PngStrategyHuffmanOnly :: PngStrategy
PngStrategyRLE :: PngStrategy
PngStrategyFixed :: PngStrategy
data PngParams
PngParams :: Int -> PngStrategy -> Bool -> PngParams
[pngParamCompression] :: PngParams -> Int
[pngParamStrategy] :: PngParams -> PngStrategy
[pngParamBinaryLevel] :: PngParams -> Bool
defaultPngParams :: PngParams
-- | Encodes an image into a memory buffer.
--
-- WARNING: This function is not thread safe!
--
-- OpenCV Sphinx doc
imencode :: OutputFormat -> Mat shape channels depth -> CvExcept ByteString
-- | Encodes an image into a memory buffer.
--
-- See imencode
imencodeM :: (PrimMonad m) => OutputFormat -> Mut (Mat shape channels depth) (PrimState m) -> CvExceptT m ByteString
-- | While OpenCV was designed for use in full-scale applications and can
-- be used within functionally rich UI frameworks (such as Qt*,
-- WinForms*, or Cocoa*) or without any UI at all, sometimes there it is
-- required to try functionality quickly and visualize the results. This
-- is what the OpenCV.HighGui module has been designed for.
--
-- It provides easy interface to:
--
-- -- cvtColor (img * 1/255) 'ColorConvBGR2Luv' ---- -- If you use cvtColor with 8-bit images, the conversion will have -- some information lost. For many applications, this will not be -- noticeable but it is recommended to use 32-bit images in applications -- that need the full range of colors or that convert an image before an -- operation and then convert back. -- -- If conversion adds the alpha channel, its value will set to the -- maximum of corresponding channel range: 255 for Word8, 65535 -- for Word16, 1 for Float. -- -- Example: -- --
-- cvtColorImg
-- :: forall (width :: Nat)
-- (width2 :: Nat)
-- (height :: Nat)
-- (channels :: Nat)
-- (depth :: *)
-- . ( Mat (ShapeT [height, width]) ('S channels) ('S depth) ~ Birds_512x341
-- , width2 ~ (width + width)
-- )
-- => Mat (ShapeT [height, width2]) ('S channels) ('S depth)
-- cvtColorImg = exceptError $
-- withMatM ((Proxy :: Proxy height) ::: (Proxy :: Proxy width2) ::: Z)
-- (Proxy :: Proxy channels)
-- (Proxy :: Proxy depth)
-- white $ \imgM -> do
-- birds_gray <- pureExcept $ cvtColor gray bgr
-- =<< cvtColor bgr gray birds_512x341
-- matCopyToM imgM (V2 0 0) birds_512x341 Nothing
-- matCopyToM imgM (V2 w 0) birds_gray Nothing
-- lift $ arrowedLine imgM (V2 startX midY) (V2 pointX midY) red 4 LineType_8 0 0.15
-- where
-- h, w :: Int32
-- h = fromInteger $ natVal (Proxy :: Proxy height)
-- w = fromInteger $ natVal (Proxy :: Proxy width)
--
-- startX, pointX :: Int32
-- startX = round $ fromIntegral w * (0.95 :: Double)
-- pointX = round $ fromIntegral w * (1.05 :: Double)
-- midY = h `div` 2
--
--
--
-- OpenCV Sphinx Doc
cvtColor :: forall (fromColor :: ColorCode) (toColor :: ColorCode) (shape :: DS [DS Nat]) (srcChannels :: DS Nat) (dstChannels :: DS Nat) (srcDepth :: DS *) (dstDepth :: DS *). (ColorConversion fromColor toColor, ColorCodeMatchesChannels fromColor srcChannels, dstChannels ~ 'S (ColorCodeChannels toColor), srcDepth `In` [ 'D, 'S Word8, 'S Word16, 'S Float], dstDepth ~ ColorCodeDepth fromColor toColor srcDepth) => Proxy fromColor -> Proxy toColor -> Mat shape srcChannels srcDepth -> CvExcept (Mat shape dstChannels dstDepth)
-- | The function floodFill fills a connected component starting
-- from the seed point with the specified color.
--
-- The connectivity is determined by the color/brightness closeness of
-- the neighbor pixels. See the OpenCV documentation for details on the
-- algorithm.
--
-- Example:
--
--
-- floodFillImg
-- :: forall (width :: Nat)
-- (width2 :: Nat)
-- (height :: Nat)
-- (channels :: Nat)
-- (depth :: *)
-- . ( Mat (ShapeT [height, width]) ('S channels) ('S depth) ~ Sailboat_768x512
-- , width2 ~ (width + width)
-- )
-- => Mat (ShapeT [height, width2]) ('S channels) ('S depth)
-- floodFillImg = exceptError $
-- withMatM ((Proxy :: Proxy height) ::: (Proxy :: Proxy width2) ::: Z)
-- (Proxy :: Proxy channels)
-- (Proxy :: Proxy depth)
-- white $ \imgM -> do
-- sailboatEvening_768x512 <- thaw sailboat_768x512
-- mask <- mkMatM (Proxy :: Proxy [height + 2, width + 2])
-- (Proxy :: Proxy 1)
-- (Proxy :: Proxy Word8)
-- black
-- circle mask (V2 450 120 :: V2 Int32) 45 white (-1) LineType_AA 0
-- rect <- floodFill sailboatEvening_768x512 (Just mask) seedPoint eveningRed (Just tolerance) (Just tolerance) defaultFloodFillOperationFlags
-- rectangle sailboatEvening_768x512 rect blue 2 LineType_8 0
-- frozenSailboatEvening_768x512 <- freeze sailboatEvening_768x512
-- matCopyToM imgM (V2 0 0) sailboat_768x512 Nothing
-- matCopyToM imgM (V2 w 0) frozenSailboatEvening_768x512 Nothing
-- lift $ arrowedLine imgM (V2 startX midY) (V2 pointX midY) red 4 LineType_8 0 0.15
-- where
-- h, w :: Int32
-- h = fromInteger $ natVal (Proxy :: Proxy height)
-- w = fromInteger $ natVal (Proxy :: Proxy width)
--
-- startX, pointX :: Int32
-- startX = round $ fromIntegral w * (0.95 :: Double)
-- pointX = round $ fromIntegral w * (1.05 :: Double)
--
-- midY = h `div` 2
--
-- seedPoint :: V2 Int32
-- seedPoint = V2 100 50
--
-- eveningRed :: V4 Double
-- eveningRed = V4 0 100 200 255
--
-- tolerance :: V4 Double
-- tolerance = pure 7
--
--
--
-- OpenCV Sphinx Doc
floodFill :: (PrimMonad m, channels `In` '[ 'S 1, 'S 3], depth `In` '[ 'D, 'S Word8, 'S Float, 'S Double], IsPoint2 point2 Int32, ToScalar color) => Mut (Mat shape channels depth) (PrimState m) -> Maybe (Mut (Mat (WidthAndHeightPlusTwo shape) ( 'S 1) ( 'S Word8)) (PrimState m)) -> point2 Int32 -> color -> Maybe color -> Maybe color -> FloodFillOperationFlags -> m Rect2i
data FloodFillOperationFlags
FloodFillOperationFlags :: Word8 -> Word8 -> Bool -> Bool -> FloodFillOperationFlags
-- | Connectivity value. The default value of 4 means that only the four
-- nearest neighbor pixels (those that share an edge) are considered. A
-- connectivity value of 8 means that the eight nearest neighbor pixels
-- (those that share a corner) will be considered.
[floodFillConnectivity] :: FloodFillOperationFlags -> Word8
-- | Value between 1 and 255 with which to fill the mask (the default value
-- is 1).
[floodFillMaskFillColor] :: FloodFillOperationFlags -> Word8
-- | If set, the difference between the current pixel and seed pixel is
-- considered. Otherwise, the difference between neighbor pixels is
-- considered (that is, the range is floating).
[floodFillFixedRange] :: FloodFillOperationFlags -> Bool
-- | If set, the function does not change the image ( newVal is ignored),
-- and only fills the mask with the value specified in bits 8-16 of flags
-- as described above. This option only make sense in function variants
-- that have the mask parameter.
[floodFillMaskOnly] :: FloodFillOperationFlags -> Bool
defaultFloodFillOperationFlags :: FloodFillOperationFlags
data ThreshType
Thresh_Binary :: !Double -> ThreshType
Thresh_BinaryInv :: !Double -> ThreshType
Thresh_Truncate :: ThreshType
Thresh_ToZero :: ThreshType
Thresh_ToZeroInv :: ThreshType
data ThreshValue
ThreshVal_Abs :: !Double -> ThreshValue
ThreshVal_Otsu :: ThreshValue
ThreshVal_Triangle :: ThreshValue
-- | Applies a fixed-level threshold to each array element
--
-- The function applies fixed-level thresholding to a single-channel
-- array. The function is typically used to get a bi-level (binary) image
-- out of a grayscale image or for removing a noise, that is, filtering
-- out pixels with too small or too large values. There are several types
-- of thresholding supported by the function.
--
-- Example:
--
--
-- grayBirds :: Mat (ShapeT [341, 512]) ('S 1) ('S Word8)
-- grayBirds = exceptError $ cvtColor bgr gray birds_512x341
--
-- threshBinaryBirds :: Mat (ShapeT [341, 512]) ('S 3) ('S Word8)
-- threshBinaryBirds =
-- exceptError $ cvtColor gray bgr $ fst $ exceptError $
-- threshold (ThreshVal_Abs 100) (Thresh_Binary 150) grayBirds
--
-- threshBinaryInvBirds :: Mat (ShapeT [341, 512]) ('S 3) ('S Word8)
-- threshBinaryInvBirds =
-- exceptError $ cvtColor gray bgr $ fst $ exceptError $
-- threshold (ThreshVal_Abs 100) (Thresh_BinaryInv 150) grayBirds
--
-- threshTruncateBirds :: Mat (ShapeT [341, 512]) ('S 3) ('S Word8)
-- threshTruncateBirds =
-- exceptError $ cvtColor gray bgr $ fst $ exceptError $
-- threshold (ThreshVal_Abs 100) Thresh_Truncate grayBirds
--
-- threshToZeroBirds :: Mat (ShapeT [341, 512]) ('S 3) ('S Word8)
-- threshToZeroBirds =
-- exceptError $ cvtColor gray bgr $ fst $ exceptError $
-- threshold (ThreshVal_Abs 100) Thresh_ToZero grayBirds
--
-- threshToZeroInvBirds :: Mat (ShapeT [341, 512]) ('S 3) ('S Word8)
-- threshToZeroInvBirds =
-- exceptError $ cvtColor gray bgr $ fst $ exceptError $
-- threshold (ThreshVal_Abs 100) Thresh_ToZeroInv grayBirds
--
--
--
-- OpenCV Sphinx doc
threshold :: (depth `In` [Word8, Float]) => ThreshValue -> ThreshType -> (Mat shape ( 'S 1) ( 'S depth)) -> CvExcept (Mat shape ( 'S 1) ( 'S depth), Double)
-- | Performs a marker-based image segmentation using the watershed
-- algorithm.
--
-- The function implements one of the variants of watershed,
-- non-parametric marker-based segmentation algorithm, described in
-- [Meyer, F. Color Image Segmentation, ICIP92, 1992].
--
-- Before passing the image to the function, you have to roughly outline
-- the desired regions in the image markers with positive (>0)
-- indices. So, every region is represented as one or more connected
-- components with the pixel values 1, 2, 3, and so on. Such markers can
-- be retrieved from a binary mask using findContours and
-- drawContours. The markers are “seeds” of the future image
-- regions. All the other pixels in markers , whose relation to the
-- outlined regions is not known and should be defined by the algorithm,
-- should be set to 0’s. In the function output, each pixel in markers is
-- set to a value of the “seed” components or to -1 at boundaries between
-- the regions.
--
-- OpenCV Sphinx doc
watershed :: (PrimMonad m) => Mat ( 'S [h, w]) ( 'S 3) ( 'S Word8) -> Mut (Mat ( 'S [h, w]) ( 'S 1) ( 'S Int32)) (PrimState m) -> CvExceptT m ()
data GrabCutOperationMode
-- | Initialize the state and the mask using the provided rectangle. After
-- that, run iterCount iterations of the algorithm. The rectangle
-- represents a ROI containing a segmented object. The pixels outside of
-- the ROI are marked as “obvious background”.
GrabCut_InitWithRect :: (Rect Int32) -> GrabCutOperationMode
-- | Initialize the state using the provided mask.
GrabCut_InitWithMask :: GrabCutOperationMode
-- | Combination of GCInitWithRect and GCInitWithMask.
-- All the pixels outside of the ROI are automatically initialized with
-- GC_BGD.
GrabCut_InitWithRectAndMask :: (Rect Int32) -> GrabCutOperationMode
-- | Just resume the algorithm.
GrabCut_Eval :: GrabCutOperationMode
-- | Runs the GrabCut algorithm.
--
-- Example:
--
--
-- grabCutBird :: Birds_512x341
-- grabCutBird = exceptError $ do
-- mask <- withMatM (Proxy :: Proxy [341, 512])
-- (Proxy :: Proxy 1)
-- (Proxy :: Proxy Word8)
-- black $ \mask -> do
-- fgTmp <- mkMatM (Proxy :: Proxy [1, 65]) (Proxy :: Proxy 1) (Proxy :: Proxy Double) black
-- bgTmp <- mkMatM (Proxy :: Proxy [1, 65]) (Proxy :: Proxy 1) (Proxy :: Proxy Double) black
-- grabCut birds_512x341 mask fgTmp bgTmp 5 (GrabCut_InitWithRect rect)
-- mask' <- matScalarCompare mask 3 Cmp_Ge
-- withMatM (Proxy :: Proxy [341, 512])
-- (Proxy :: Proxy 3)
-- (Proxy :: Proxy Word8)
-- transparent $ \imgM -> do
-- matCopyToM imgM (V2 0 0) birds_512x341 (Just mask')
-- where
-- rect :: Rect Int32
-- rect = toRect $ HRect { hRectTopLeft = V2 264 60, hRectSize = V2 248 281 }
--
--
grabCut :: (PrimMonad m, depth `In` '[ 'D, 'S Word8]) => Mat shape ( 'S 3) depth -> Mut (Mat shape ( 'S 1) ( 'S Word8)) (PrimState m) -> Mut (Mat ( 'S [ 'S 1, 'S 65]) ( 'S 1) ( 'S Double)) (PrimState m) -> Mut (Mat ( 'S [ 'S 1, 'S 65]) ( 'S 1) ( 'S Double)) (PrimState m) -> Int32 -> GrabCutOperationMode -> CvExceptT m ()
-- | Returns 0 if the pixels are not in the range, 255 otherwise.
inRange :: (ToScalar scalar) => Mat ( 'S [w, h]) channels depth -> scalar -> scalar -> CvExcept (Mat ( 'S [w, h]) ( 'S 1) ( 'S Word8))
-- | Functions and classes described in this section are used to perform
-- various linear or non-linear filtering operations on 2D images
-- (represented as Mat's). It means that for each pixel
-- location (x,y) in the source image (normally, rectangular),
-- its neighborhood is considered and used to compute the response. In
-- case of a linear filter, it is a weighted sum of pixel values. In case
-- of morphological operations, it is the minimum or maximum values, and
-- so on. The computed response is stored in the destination image at the
-- same location (x,y). It means that the output image will be
-- of the same size as the input image. Normally, the functions support
-- multi-channel arrays, in which case every channel is processed
-- independently. Therefore, the output image will also have the same
-- number of channels as the input one.
--
-- Another common feature of the functions and classes described in this
-- section is that, unlike simple arithmetic functions, they need to
-- extrapolate values of some non-existing pixels. For example, if you
-- want to smooth an image using a Gaussian 3x3 filter, then,
-- when processing the left-most pixels in each row, you need pixels to
-- the left of them, that is, outside of the image. You can let these
-- pixels be the same as the left-most image pixels ("replicated border"
-- extrapolation method), or assume that all the non-existing pixels are
-- zeros ("constant border" extrapolation method), and so on. OpenCV
-- enables you to specify the extrapolation method.
module OpenCV.ImgProc.ImgFiltering
data MorphShape
-- | A rectangular structuring element.
MorphRect :: MorphShape
-- | An elliptic structuring element, that is, a filled ellipse inscribed
-- into the rectangle Rect(0, 0, esize.width, 0.esize.height).
MorphEllipse :: MorphShape
-- | A cross-shaped structuring element.
MorphCross :: !Point2i -> MorphShape
data MorphOperation
-- | An opening operation: dilate . erode
MorphOpen :: MorphOperation
-- | A closing operation: erode . dilate
MorphClose :: MorphOperation
-- | A morphological gradient: dilate - erode
MorphGradient :: MorphOperation
-- | "top hat": src - open
MorphTopHat :: MorphOperation
-- | "black hat": close - src
MorphBlackHat :: MorphOperation
-- | Calculates the bilateralFilter of an image
--
-- The function applies bilateral filtering to the input image, as
-- described in Bilateral_Filtering bilateralFilter can reduce
-- unwanted noise very well while keeping edges fairly sharp. However, it
-- is very slow compared to most filters. Example:
--
--
-- bilateralFilterImg
-- :: forall (width :: Nat)
-- (width2 :: Nat)
-- (height :: Nat)
-- (channels :: Nat)
-- (depth :: *)
-- . ( Mat (ShapeT [height, width]) ('S channels) ('S depth) ~ Birds_512x341
-- , width2 ~ ((*) width 2) -- TODO (RvD): HSE parse error with infix type operator
-- )
-- => Mat (ShapeT [height, width2]) ('S channels) ('S depth)
-- bilateralFilterImg = exceptError $
-- withMatM (Proxy :: Proxy [height, width2])
-- (Proxy :: Proxy channels)
-- (Proxy :: Proxy depth)
-- white $ imgM -> do
-- birdsFiltered <- pureExcept $ bilateralFilter (Just 9) Nothing Nothing Nothing birds_512x341
-- matCopyToM imgM (V2 0 0) birds_512x341 Nothing
-- matCopyToM imgM (V2 w 0) birdsFiltered Nothing
-- where
-- w = fromInteger $ natVal (Proxy :: Proxy width)
--
--
--
-- OpenCV Sphinx doc
bilateralFilter :: (depth `In` '[Word8, Float, Double], channels `In` '[1, 3]) => Maybe Int32 -> Maybe Double -> Maybe Double -> Maybe BorderMode -> Mat shape ( 'S channels) ( 'S depth) -> CvExcept (Mat shape ( 'S channels) ( 'S depth))
-- | Calculates the Laplacian of an image
--
-- The function calculates the Laplacian of the source image by adding up
-- the second x and y derivatives calculated using the Sobel operator.
--
-- Example:
--
--
-- laplacianImg
-- :: forall shape channels depth
-- . (Mat shape channels depth ~ Birds_512x341)
-- => Mat shape ('S 1) ('S Double)
-- laplacianImg = exceptError $ do
-- imgG <- cvtColor bgr gray birds_512x341
-- laplacian Nothing Nothing Nothing Nothing imgG
--
--
--
-- OpenCV Sphinx doc
laplacian :: forall shape channels srcDepth dstDepth. (ToDepth (Proxy dstDepth)) => Maybe Int32 -> Maybe Double -> Maybe Double -> Maybe BorderMode -> Mat shape channels srcDepth -> CvExcept (Mat shape channels ( 'S dstDepth))
-- | Blurs an image using the median filter
--
-- Example:
--
--
-- medianBlurImg
-- :: forall (width :: Nat)
-- (width2 :: Nat)
-- (height :: Nat)
-- (channels :: Nat)
-- (depth :: *)
-- . ( Mat (ShapeT [height, width]) ('S channels) ('S depth) ~ Birds_512x341
-- , width2 ~ ((*) width 2) -- TODO (RvD): HSE parse error with infix type operator
-- )
-- => Mat (ShapeT [height, width2]) ('S channels) ('S depth)
-- medianBlurImg = exceptError $
-- withMatM (Proxy :: Proxy [height, width2])
-- (Proxy :: Proxy channels)
-- (Proxy :: Proxy depth)
-- white $ \imgM -> do
-- birdsBlurred <- pureExcept $ medianBlur birds_512x341 13
-- matCopyToM imgM (V2 0 0) birds_512x341 Nothing
-- matCopyToM imgM (V2 w 0) birdsBlurred Nothing
-- where
-- w = fromInteger $ natVal (Proxy :: Proxy width)
--
--
--
-- OpenCV Sphinx doc
medianBlur :: (depth `In` '[Word8, Word16, Float], channels `In` '[1, 3, 4]) => Mat shape ( 'S channels) ( 'S depth) -> Int32 -> CvExcept (Mat shape ( 'S channels) ( 'S depth))
-- | Erodes an image by using a specific structuring element
--
-- Example:
--
--
-- erodeImg
-- :: forall (width :: Nat)
-- (width2 :: Nat)
-- (height :: Nat)
-- (channels :: Nat)
-- (depth :: *)
-- . ( Mat (ShapeT [height, width]) ('S channels) ('S depth) ~ Lambda
-- , width2 ~ ((*) width 2) -- TODO (RvD): HSE parse error with infix type operator
-- )
-- => Mat (ShapeT [height, width2]) ('S channels) ('S depth)
-- erodeImg = exceptError $
-- withMatM (Proxy :: Proxy [height, width2])
-- (Proxy :: Proxy channels)
-- (Proxy :: Proxy depth)
-- white $ \imgM -> do
-- erodedLambda <-
-- pureExcept $ erode lambda Nothing (Nothing :: Maybe Point2i) 5 BorderReplicate
-- matCopyToM imgM (V2 0 0) lambda Nothing
-- matCopyToM imgM (V2 w 0) erodedLambda Nothing
-- where
-- w = fromInteger $ natVal (Proxy :: Proxy width)
--
--
--
-- OpenCV Sphinx doc
erode :: (IsPoint2 point2 Int32, depth `In` [Word8, Word16, Int16, Float, Double]) => Mat shape channels ( 'S depth) -> Maybe (Mat ( 'S [sh, sw]) ( 'S 1) ( 'S Word8)) -> Maybe (point2 Int32) -> Int -> BorderMode -> CvExcept (Mat shape channels ( 'S depth))
-- | Dilates an image by using a specific structuring element
--
-- Example:
--
--
-- dilateImg
-- :: forall (width :: Nat)
-- (width2 :: Nat)
-- (height :: Nat)
-- (channels :: Nat)
-- (depth :: *)
-- . ( Mat (ShapeT [height, width]) ('S channels) ('S depth) ~ Lambda
-- , width2 ~ ((*) width 2) -- TODO (RvD): HSE parse error with infix type operator
-- )
-- => Mat (ShapeT [height, width2]) ('S channels) ('S depth)
-- dilateImg = exceptError $
-- withMatM (Proxy :: Proxy [height, width2])
-- (Proxy :: Proxy channels)
-- (Proxy :: Proxy depth)
-- white $ \imgM -> do
-- dilatedLambda <-
-- pureExcept $ dilate lambda Nothing (Nothing :: Maybe Point2i) 3 BorderReplicate
-- matCopyToM imgM (V2 0 0) lambda Nothing
-- matCopyToM imgM (V2 w 0) dilatedLambda Nothing
-- where
-- w = fromInteger $ natVal (Proxy :: Proxy width)
--
--
--
-- OpenCV Sphinx doc
dilate :: (IsPoint2 point2 Int32, depth `In` [Word8, Word16, Int16, Float, Double]) => Mat shape channels ( 'S depth) -> Maybe (Mat ( 'S [sh, sw]) ( 'S 1) ( 'S Word8)) -> Maybe (point2 Int32) -> Int -> BorderMode -> CvExcept (Mat shape channels ( 'S depth))
-- | Convolves an image with the kernel.
--
-- Example:
--
--
-- filter2DImg
-- :: forall (width :: Nat)
-- (width2 :: Nat)
-- (height :: Nat)
-- (channels :: Nat)
-- (depth :: *)
-- . ( Mat (ShapeT [height, width]) ('S channels) ('S depth) ~ Birds_512x341
-- , width2 ~ ((*) width 2) -- TODO (RvD): HSE parse error with infix type operator
-- )
-- => Mat (ShapeT [height, width2]) ('S channels) ('S depth)
-- filter2DImg = exceptError $
-- withMatM (Proxy :: Proxy [height, width2])
-- (Proxy :: Proxy channels)
-- (Proxy :: Proxy depth)
-- white $ \imgM -> do
-- filteredBird <-
-- pureExcept $ filter2D birds_512x341 kernel (Nothing :: Maybe Point2i) 0 BorderReplicate
-- matCopyToM imgM (V2 0 0) birds_512x341 Nothing
-- matCopyToM imgM (V2 w 0) filteredBird Nothing
-- where
-- w = fromInteger $ natVal (Proxy :: Proxy width)
-- kernel =
-- exceptError $
-- withMatM (Proxy :: Proxy [3, 3])
-- (Proxy :: Proxy 1)
-- (Proxy :: Proxy Double)
-- black $ \imgM -> do
-- lift $ line imgM (V2 0 0 :: V2 Int32) (V2 0 0 :: V2 Int32) (V4 (-2) (-2) (-2) 1 :: V4 Double) 0 LineType_8 0
-- lift $ line imgM (V2 1 0 :: V2 Int32) (V2 0 1 :: V2 Int32) (V4 (-1) (-1) (-1) 1 :: V4 Double) 0 LineType_8 0
-- lift $ line imgM (V2 1 1 :: V2 Int32) (V2 1 1 :: V2 Int32) (V4 1 1 1 1 :: V4 Double) 0 LineType_8 0
-- lift $ line imgM (V2 1 2 :: V2 Int32) (V2 2 1 :: V2 Int32) (V4 1 1 1 1 :: V4 Double) 0 LineType_8 0
-- lift $ line imgM (V2 2 2 :: V2 Int32) (V2 2 2 :: V2 Int32) (V4 2 2 2 1 :: V4 Double) 0 LineType_8 0
--
--
--
-- OpenCV Sphinx doc
filter2D :: (IsPoint2 point2 Int32, depth `In` [Word8, Word16, Int16, Float, Double]) => Mat shape channels ( 'S depth) -> Mat ( 'S [sh, sw]) ( 'S 1) ( 'S Double) -> Maybe (point2 Int32) -> Double -> BorderMode -> CvExcept (Mat shape channels ( 'S depth))
-- | Performs advanced morphological transformations
--
-- OpenCV Sphinx doc
morphologyEx :: (IsPoint2 point2 Int32, depth `In` [Word8, Word16, Int16, Float, Double]) => Mat shape channels ( 'S depth) -> MorphOperation -> Mat 'D 'D 'D -> Maybe (point2 Int32) -> Int -> BorderMode -> CvExcept (Mat shape channels ( 'S depth))
-- | Returns a structuring element of the specified size and shape for
-- morphological operations
--
-- Example:
--
--
-- type StructureImg = Mat (ShapeT [128, 128]) ('S 1) ('S Word8)
--
-- structureImg :: MorphShape -> StructureImg
-- structureImg shape = exceptError $ do
-- mat <- getStructuringElement shape (Proxy :: Proxy 128) (Proxy :: Proxy 128)
-- img <- matConvertTo (Just 255) Nothing mat
-- bitwiseNot img
--
-- morphRectImg :: StructureImg
-- morphRectImg = structureImg MorphRect
--
-- morphEllipseImg :: StructureImg
-- morphEllipseImg = structureImg MorphEllipse
--
-- morphCrossImg :: StructureImg
-- morphCrossImg = structureImg $ MorphCross $ toPoint (pure (-1) :: V2 Int32)
--
--
--
-- OpenCV Sphinx doc
getStructuringElement :: (ToInt32 height, ToInt32 width) => MorphShape -> height -> width -> CvExcept (Mat (ShapeT (height ::: (width ::: Z))) ( 'S 1) ( 'S Word8))
-- | Blurs an image using a box filter.
--
-- Example:
--
--
-- boxBlurImg
-- :: forall (width :: Nat)
-- (width2 :: Nat)
-- (height :: Nat)
-- (channels :: Nat)
-- (depth :: *)
-- . ( Mat (ShapeT [height, width]) ('S channels) ('S depth) ~ Birds_512x341
-- , width2 ~ ((*) width 2) -- TODO (RvD): HSE parse error with infix type operator
-- )
-- => Mat (ShapeT [height, width2]) ('S channels) ('S depth)
-- boxBlurImg = exceptError $
-- withMatM (Proxy :: Proxy [height, width2])
-- (Proxy :: Proxy channels)
-- (Proxy :: Proxy depth)
-- white $ \imgM -> do
-- birdsBlurred <- pureExcept $ blur (V2 13 13 :: V2 Int32) birds_512x341
-- matCopyToM imgM (V2 0 0) birds_512x341 Nothing
-- matCopyToM imgM (V2 w 0) birdsBlurred Nothing
-- where
-- w = fromInteger $ natVal (Proxy :: Proxy width)
--
--
--
-- OpenCV Sphinx doc
blur :: (depth `In` '[Word8, Word16, Int16, Float, Double], IsSize size Int32) => size Int32 -> Mat shape ( 'S channels) ( 'S depth) -> CvExcept (Mat shape ( 'S channels) ( 'S depth))
gaussianBlur :: (depth `In` '[Word8, Word16, Float, Double], IsSize size Int32) => size Int32 -> Double -> Double -> Mat shape ( 'S channels) ( 'S depth) -> CvExcept (Mat shape ( 'S channels) ( 'S depth))
-- | The functions in this section perform various geometrical
-- transformations of 2D images. They do not change the image content but
-- deform the pixel grid and map this deformed grid to the destination
-- image. In fact, to avoid sampling artifacts, the mapping is done in
-- the reverse order, from destination to the source. That is, for each
-- pixel (x,y) of the destination image, the functions compute
-- coordinates of the corresponding "donor" pixel in the source image and
-- copy the pixel value:
--
-- -- dst(x,y) = src(fx(x,y), fy(x,y)) ---- -- In case when you specify the forward mapping <gx,gy> : src -- -> dst, the OpenCV functions first compute the corresponding -- inverse mapping <fx,fy>:dst->src and then use the -- above formula. -- -- The actual implementations of the geometrical transformations, from -- the most generic remap and to the simplest and the fastest resize, -- need to solve two main problems with the above formula: -- --
-- resizeInterAreaImg :: Mat ('S ['D, 'D]) ('S 3) ('S Word8)
-- resizeInterAreaImg = exceptError $
-- withMatM (h ::: w + (w `div` 2) ::: Z)
-- (Proxy :: Proxy 3)
-- (Proxy :: Proxy Word8)
-- transparent $ \imgM -> do
-- birds_resized <-
-- pureExcept $ resize (ResizeRel $ pure 0.5) InterArea birds_768x512
-- matCopyToM imgM (V2 0 0) birds_768x512 Nothing
-- matCopyToM imgM (V2 w 0) birds_resized Nothing
-- lift $ arrowedLine imgM (V2 startX y) (V2 pointX y) red 4 LineType_8 0 0.15
-- where
-- [h, w] = miShape $ matInfo birds_768x512
-- startX = round $ fromIntegral w * (0.95 :: Double)
-- pointX = round $ fromIntegral w * (1.05 :: Double)
-- y = h `div` 4
--
--
--
-- OpenCV Sphinx doc
resize :: ResizeAbsRel -> InterpolationMethod -> Mat ( 'S [height, width]) channels depth -> CvExcept (Mat ( 'S [ 'D, 'D]) channels depth)
-- | Applies an affine transformation to an image
--
-- Example:
--
--
-- rotateBirds :: Mat (ShapeT [2, 3]) ('S 1) ('S Double)
-- rotateBirds = getRotationMatrix2D (V2 256 170 :: V2 CFloat) 45 0.75
--
-- warpAffineImg :: Birds_512x341
-- warpAffineImg = exceptError $
-- warpAffine birds_512x341 rotateBirds InterArea False False (BorderConstant black)
--
-- warpAffineInvImg :: Birds_512x341
-- warpAffineInvImg = exceptError $
-- warpAffine warpAffineImg rotateBirds InterCubic True False (BorderConstant black)
--
--
--
-- OpenCV Sphinx doc
warpAffine :: Mat ( 'S [height, width]) channels depth -> Mat (ShapeT [2, 3]) ( 'S 1) ( 'S Double) -> InterpolationMethod -> Bool -> Bool -> BorderMode -> CvExcept (Mat ( 'S [height, width]) channels depth)
-- | Applies a perspective transformation to an image
--
-- OpenCV Sphinx doc
warpPerspective :: Mat ( 'S [height, width]) channels depth -> Mat (ShapeT [3, 3]) ( 'S 1) ( 'S Double) -> InterpolationMethod -> Bool -> Bool -> BorderMode -> CvExcept (Mat ( 'S [height, width]) channels depth)
-- | Inverts an affine transformation
--
-- OpenCV Sphinx doc
invertAffineTransform :: Mat (ShapeT [2, 3]) ( 'S 1) depth -> CvExcept (Mat (ShapeT [2, 3]) ( 'S 1) depth)
-- | Calculates a perspective transformation matrix for 2D perspective
-- transform
--
-- OpenCV Sphinx doc
getPerspectiveTransform :: (IsPoint2 point2 CFloat) => Vector (point2 CFloat) -> Vector (point2 CFloat) -> Mat (ShapeT [3, 3]) ( 'S 1) ( 'S Double)
-- | Calculates an affine matrix of 2D rotation
--
-- OpenCV Sphinx doc
getRotationMatrix2D :: (IsPoint2 point2 CFloat) => point2 CFloat -> Double -> Double -> Mat (ShapeT [2, 3]) ( 'S 1) ( 'S Double)
-- | Applies a generic geometrical transformation to an image.
--
-- The function remap transforms the source image using the specified
-- map:
--
-- -- dst(x,y) = src(map(x,y)) ---- -- Example: -- --
-- remapImg
-- :: forall (width :: Nat)
-- (height :: Nat)
-- (channels :: Nat)
-- (depth :: * )
-- . (Mat ('S ['S height, 'S width]) ('S channels) ('S depth) ~ Birds_512x341)
-- => Mat ('S ['S height, 'S width]) ('S channels) ('S depth)
-- remapImg = exceptError $ remap birds_512x341 transform InterLinear (BorderConstant black)
-- where
-- transform = exceptError $
-- matFromFunc (Proxy :: Proxy [height, width])
-- (Proxy :: Proxy 2)
-- (Proxy :: Proxy Float)
-- exampleFunc
--
-- exampleFunc [_y, x] 0 = wobble x w
-- exampleFunc [ y, _x] 1 = wobble y h
-- exampleFunc _pos _channel = error "impossible"
--
-- wobble :: Int -> Float -> Float
-- wobble v s = let v' = fromIntegral v
-- n = v' / s
-- in v' + (s * 0.05 * sin (n * 2 * pi * 5))
--
-- w = fromInteger $ natVal (Proxy :: Proxy width)
-- h = fromInteger $ natVal (Proxy :: Proxy height)
--
--
--
-- OpenCV documentation
remap :: Mat ( 'S [inputHeight, inputWidth]) inputChannels inputDepth -> Mat ( 'S [outputHeight, outputWidth]) ( 'S 2) ( 'S Float) -> InterpolationMethod -> BorderMode -> CvExcept (Mat ( 'S [outputHeight, outputWidth]) inputChannels inputDepth)
-- | The function transforms an image to compensate radial and tangential
-- lens distortion.
--
-- Those pixels in the destination image, for which there is no
-- correspondent pixels in the source image, are filled with zeros (black
-- color).
--
-- The camera matrix and the distortion parameters can be determined
-- using calibrateCamera . If the resolution of images is
-- different from the resolution used at the calibration stage, f_x, f_y,
-- c_x and c_y need to be scaled accordingly, while the distortion
-- coefficients remain the same.
--
-- Example:
--
--
-- undistortImg
-- :: forall (width :: Nat)
-- (height :: Nat)
-- (channels :: Nat)
-- (depth :: * )
-- . (Mat ('S ['S height, 'S width]) ('S channels) ('S depth) ~ Birds_512x341)
-- => Mat ('S ['S height, 'S width]) ('S channels) ('S depth)
-- undistortImg = undistort birds_512x341 intrinsics coefficients
-- where intrinsics :: M33 Float
-- intrinsics =
-- V3 (V3 15840.8 0 2049)
-- (V3 0 15830.3 1097)
-- (V3 0 0 1)
--
-- coefficients :: Matx51d
-- coefficients = unsafePerformIO $
-- newMatx51d
-- (-2.239145913492247)
-- 13.674526561736648
-- 3.650187848850095e-2
-- (-2.0042015752853796e-2)
-- (-0.44790921357620456)
--
--
undistort :: (ToMat m33d, MatShape m33d ~ 'S '[ 'S 3, 'S 3], ToMat distCoeffs, MatShape distCoeffs `In` '[ 'S '[ 'S 4, 'S 1], 'S '[ 'S 5, 'S 1], 'S '[ 'S 8, 'S 1], 'S '[ 'S 12, 'S 1], 'S '[ 'S 14, 'S 1]]) => Mat ( 'S '[h, w]) c d -> m33d -> distCoeffs -> Mat ( 'S '[h, w]) c d
instance GHC.Show.Show OpenCV.ImgProc.GeometricImgTransform.ResizeAbsRel
module OpenCV.ImgProc.FeatureDetection
-- | Finds edges in an image using the Canny86 algorithm.
--
-- Example:
--
--
-- cannyImg
-- :: forall shape channels depth
-- . (Mat shape channels depth ~ Lambda)
-- => Mat shape ('S 1) depth
-- cannyImg = exceptError $
-- canny 30 200 Nothing CannyNormL1 lambda
--
--
canny :: Double -> Double -> Maybe Int32 -> CannyNorm -> Mat ( 'S [h, w]) channels ( 'S Word8) -> CvExcept (Mat ( 'S [h, w]) ( 'S 1) ( 'S Word8))
-- | Determines strong corners on an image.
--
-- The function finds the most prominent corners in the image or in the
-- specified image region.
--
--
-- goodFeaturesToTrackTraces
-- :: 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)
-- goodFeaturesToTrackTraces = exceptError $ do
-- imgG <- cvtColor bgr gray frog
-- let features = goodFeaturesToTrack imgG 20 0.01 0.5 Nothing Nothing CornerMinEigenVal
-- withMatM (Proxy :: Proxy [height, width])
-- (Proxy :: Proxy channels)
-- (Proxy :: Proxy depth)
-- white $ \imgM -> do
-- void $ matCopyToM imgM (V2 0 0) frog Nothing
-- forM_ features $ \f -> do
-- circle imgM (round <$> f :: V2 Int32) 2 blue 5 LineType_AA 0
--
--
goodFeaturesToTrack :: (depth `In` [ 'S Word8, 'S Float, 'D]) => Mat ( 'S [h, w]) ( 'S 1) depth -> Int32 -> Double -> Double -> Maybe (Mat ( 'S [h, w]) ( 'S 1) ( 'S Word8)) -> Maybe Int32 -> GoodFeaturesToTrackDetectionMethod -> Vector (V2 Float)
-- | Finds circles in a grayscale image using a modification of the Hough
-- transformation.
--
-- Example:
--
--
-- houghCircleTraces
-- :: forall (width :: Nat)
-- (height :: Nat)
-- (channels :: Nat)
-- (depth :: *)
-- . (Mat (ShapeT [height, width]) ('S channels) ('S depth) ~ Circles_1000x625)
-- => Mat (ShapeT [height, width]) ('S channels) ('S depth)
-- houghCircleTraces = exceptError $ do
-- imgG <- cvtColor bgr gray circles_1000x625
-- let circles = houghCircles 1 10 Nothing Nothing Nothing Nothing imgG
-- withMatM (Proxy :: Proxy [height, width])
-- (Proxy :: Proxy channels)
-- (Proxy :: Proxy depth)
-- white $ \imgM -> do
-- void $ matCopyToM imgM (V2 0 0) circles_1000x625 Nothing
-- forM_ circles $ \c -> do
-- circle imgM (round <$> circleCenter c :: V2 Int32) (round (circleRadius c)) blue 1 LineType_AA 0
--
--
houghCircles :: Double -> Double -> Maybe Double -> Maybe Double -> Maybe Int32 -> Maybe Int32 -> Mat ( 'S [h, w]) ( 'S 1) ( 'S Word8) -> Vector Circle
-- | Example:
--
--
-- houghLinesPTraces
-- :: forall (width :: Nat)
-- (height :: Nat)
-- (channels :: Nat)
-- (depth :: * )
-- . (Mat (ShapeT [height, width]) ('S channels) ('S depth) ~ Building_868x600)
-- => Mat (ShapeT [height, width]) ('S channels) ('S depth)
-- houghLinesPTraces = exceptError $ do
-- edgeImg <- canny 50 200 Nothing CannyNormL1 building_868x600
-- edgeImgBgr <- cvtColor gray bgr edgeImg
-- withMatM (Proxy :: Proxy [height, width])
-- (Proxy :: Proxy channels)
-- (Proxy :: Proxy depth)
-- white $ \imgM -> do
-- edgeImgM <- thaw edgeImg
-- lineSegments <- houghLinesP 1 (pi / 180) 80 (Just 30) (Just 10) edgeImgM
-- void $ matCopyToM imgM (V2 0 0) edgeImgBgr Nothing
-- forM_ lineSegments $ \lineSegment -> do
-- line imgM
-- (lineSegmentStart lineSegment)
-- (lineSegmentStop lineSegment)
-- red 2 LineType_8 0
--
--
houghLinesP :: (PrimMonad m) => Double -> Double -> Int32 -> Maybe Double -> Maybe Double -> Mut (Mat ( 'S [h, w]) ( 'S 1) ( 'S Word8)) (PrimState m) -> m (Vector (LineSegment Int32))
data GoodFeaturesToTrackDetectionMethod
-- | Harris detector and it free k parameter
HarrisDetector :: Double -> GoodFeaturesToTrackDetectionMethod
CornerMinEigenVal :: GoodFeaturesToTrackDetectionMethod
-- | A flag, indicating whether to use the more accurate L2 norm or the
-- default L1 norm.
data CannyNorm
CannyNormL1 :: CannyNorm
CannyNormL2 :: CannyNorm
data Circle
Circle :: V2 Float -> Float -> Circle
[circleCenter] :: Circle -> V2 Float
[circleRadius] :: Circle -> Float
data LineSegment depth
LineSegment :: !(V2 depth) -> !(V2 depth) -> LineSegment depth
[lineSegmentStart] :: LineSegment depth -> !(V2 depth)
[lineSegmentStop] :: LineSegment depth -> !(V2 depth)
instance GHC.Show.Show depth => GHC.Show.Show (OpenCV.ImgProc.FeatureDetection.LineSegment depth)
instance Data.Traversable.Traversable OpenCV.ImgProc.FeatureDetection.LineSegment
instance GHC.Base.Functor OpenCV.ImgProc.FeatureDetection.LineSegment
instance Data.Foldable.Foldable OpenCV.ImgProc.FeatureDetection.LineSegment
instance GHC.Classes.Eq OpenCV.ImgProc.FeatureDetection.GoodFeaturesToTrackDetectionMethod
instance GHC.Show.Show OpenCV.ImgProc.FeatureDetection.GoodFeaturesToTrackDetectionMethod
instance GHC.Show.Show OpenCV.ImgProc.FeatureDetection.Circle
instance GHC.Classes.Eq OpenCV.ImgProc.FeatureDetection.CannyNorm
instance GHC.Show.Show OpenCV.ImgProc.FeatureDetection.CannyNorm
instance OpenCV.Internal.Core.Types.Vec.IsVec Linear.V4.V4 depth => OpenCV.Internal.Core.Types.Vec.IsVec OpenCV.ImgProc.FeatureDetection.LineSegment depth
module OpenCV.ImgProc.Drawing
data LineType
-- | 8-connected line.
--
LineType_8 :: LineType
-- | 4-connected line.
--
LineType_4 :: LineType
-- | Antialiased line.
--
LineType_AA :: LineType
data Font
Font :: !FontFace -> !FontSlant -> !Double -> Font
[_fontFace] :: Font -> !FontFace
[_fontSlant] :: Font -> !FontSlant
[_fontScale] :: Font -> !Double
data FontFace
-- | Normal size sans-serif font. Does not have a Slanted variant.
--
FontHersheySimplex :: FontFace
-- | Small size sans-serif font.
--
--
FontHersheyPlain :: FontFace
-- | Normal size sans-serif font (more complex than
-- FontHersheySimplex). Does not have a Slanted variant.
--
FontHersheyDuplex :: FontFace
-- | Normal size serif font.
--
--
FontHersheyComplex :: FontFace
-- | Normal size serif font (more complex than FontHersheyComplex).
--
--
FontHersheyTriplex :: FontFace
-- | Smaller version of FontHersheyComplex.
--
--
FontHersheyComplexSmall :: FontFace
-- | Hand-writing style font. Does not have a Slanted variant.
--
FontHersheyScriptSimplex :: FontFace
-- | More complex variant of FontHersheyScriptSimplex. Does not have
-- a Slanted variant.
--
FontHersheyScriptComplex :: FontFace
data FontSlant
NotSlanted :: FontSlant
Slanted :: FontSlant
data ContourDrawMode
-- | Thickness of lines the contours are drawn with.
OutlineContour :: LineType -> Int32 -> ContourDrawMode
-- | Draw the contour, filling in the area.
FillContours :: ContourDrawMode
-- | Draws a arrow segment pointing from the first point to the second one
--
-- Example:
--
--
-- arrowedLineImg :: Mat (ShapeT [200, 300]) ('S 4) ('S Word8)
-- arrowedLineImg = exceptError $
-- withMatM
-- (Proxy :: Proxy [200, 300])
-- (Proxy :: Proxy 4)
-- (Proxy :: Proxy Word8)
-- transparent $ \imgM -> do
-- arrowedLine imgM (V2 10 130 :: V2 Int32) (V2 190 40 :: V2 Int32) blue 5 LineType_AA 0 0.15
-- arrowedLine imgM (V2 210 50 :: V2 Int32) (V2 250 180 :: V2 Int32) red 8 LineType_AA 0 0.4
--
--
--
-- OpenCV Doxygen doc OpenCV Sphinx doc
arrowedLine :: (IsPoint2 fromPoint2 Int32, IsPoint2 toPoint2 Int32, ToScalar color, PrimMonad m) => Mut (Mat ( 'S [height, width]) channels depth) (PrimState m) -> fromPoint2 Int32 -> toPoint2 Int32 -> color -> Int32 -> LineType -> Int32 -> Double -> m ()
-- | Draws a circle.
--
-- Example:
--
--
-- circleImg :: Mat (ShapeT [200, 400]) ('S 4) ('S Word8)
-- circleImg = exceptError $
-- withMatM
-- (Proxy :: Proxy [200, 400])
-- (Proxy :: Proxy 4)
-- (Proxy :: Proxy Word8)
-- transparent $ \imgM -> do
-- lift $ circle imgM (V2 100 100 :: V2 Int32) 90 blue 5 LineType_AA 0
-- lift $ circle imgM (V2 300 100 :: V2 Int32) 45 red (-1) LineType_AA 0
--
--
--
-- OpenCV Sphinx doc
circle :: (PrimMonad m, IsPoint2 point2 Int32, ToScalar color) => Mut (Mat ( 'S [height, width]) channels depth) (PrimState m) -> point2 Int32 -> Int32 -> color -> Int32 -> LineType -> Int32 -> m ()
-- | Draws a simple or thick elliptic arc or fills an ellipse sector
--
-- Example:
--
--
-- ellipseImg :: Mat (ShapeT [200, 400]) ('S 4) ('S Word8)
-- ellipseImg = exceptError $
-- withMatM
-- (Proxy :: Proxy [200, 400])
-- (Proxy :: Proxy 4)
-- (Proxy :: Proxy Word8)
-- transparent $ \imgM -> do
-- lift $ ellipse imgM (V2 100 100 :: V2 Int32) (V2 90 60 :: V2 Int32) 30 0 360 blue 5 LineType_AA 0
-- lift $ ellipse imgM (V2 300 100 :: V2 Int32) (V2 80 40 :: V2 Int32) 160 40 290 red (-1) LineType_AA 0
--
--
--
-- OpenCV Sphinx doc
ellipse :: (PrimMonad m, IsPoint2 point2 Int32, IsSize size Int32, ToScalar color) => Mut (Mat ( 'S [height, width]) channels depth) (PrimState m) -> point2 Int32 -> size Int32 -> Double -> Double -> Double -> color -> Int32 -> LineType -> Int32 -> m ()
-- | Fills a convex polygon.
--
-- The function fillConvexPoly draws a filled convex polygon. This
-- function is much faster than the function fillPoly . It can
-- fill not only convex polygons but any monotonic polygon without
-- self-intersections, that is, a polygon whose contour intersects every
-- horizontal line (scan line) twice at the most (though, its top-most
-- and/or the bottom edge could be horizontal).
--
-- Example:
--
--
-- fillConvexPolyImg
-- :: forall (h :: Nat) (w :: Nat)
-- . (h ~ 300, w ~ 300)
-- => Mat (ShapeT [h, w]) ('S 4) ('S Word8)
-- fillConvexPolyImg = exceptError $
-- withMatM (Proxy :: Proxy [h, w])
-- (Proxy :: Proxy 4)
-- (Proxy :: Proxy Word8)
-- transparent $ \imgM -> do
-- lift $ fillConvexPoly imgM pentagon blue LineType_AA 0
-- where
-- pentagon :: V.Vector (V2 Int32)
-- pentagon = V.fromList
-- [ V2 150 0
-- , V2 7 104
-- , V2 62 271
-- , V2 238 271
-- , V2 293 104
-- ]
--
--
--
-- OpenCV Sphinx doc
fillConvexPoly :: (PrimMonad m, IsPoint2 point2 Int32, ToScalar color) => Mut (Mat ( 'S [height, width]) channels depth) (PrimState m) -> Vector (point2 Int32) -> color -> LineType -> Int32 -> m ()
-- | Fills the area bounded by one or more polygons.
--
-- Example:
--
--
-- rookPts :: Int32 -> Int32 -> V.Vector (V.Vector (V2 Int32))
-- rookPts w h = V.singleton $ V.fromList
-- [ V2 ( w `div` 4) ( 7*h `div` 8)
-- , V2 ( 3*w `div` 4) ( 7*h `div` 8)
-- , V2 ( 3*w `div` 4) (13*h `div` 16)
-- , V2 ( 11*w `div` 16) (13*h `div` 16)
-- , V2 ( 19*w `div` 32) ( 3*h `div` 8)
-- , V2 ( 3*w `div` 4) ( 3*h `div` 8)
-- , V2 ( 3*w `div` 4) ( h `div` 8)
-- , V2 ( 26*w `div` 40) ( h `div` 8)
-- , V2 ( 26*w `div` 40) ( h `div` 4)
-- , V2 ( 22*w `div` 40) ( h `div` 4)
-- , V2 ( 22*w `div` 40) ( h `div` 8)
-- , V2 ( 18*w `div` 40) ( h `div` 8)
-- , V2 ( 18*w `div` 40) ( h `div` 4)
-- , V2 ( 14*w `div` 40) ( h `div` 4)
-- , V2 ( 14*w `div` 40) ( h `div` 8)
-- , V2 ( w `div` 4) ( h `div` 8)
-- , V2 ( w `div` 4) ( 3*h `div` 8)
-- , V2 ( 13*w `div` 32) ( 3*h `div` 8)
-- , V2 ( 5*w `div` 16) (13*h `div` 16)
-- , V2 ( w `div` 4) (13*h `div` 16)
-- ]
--
-- fillPolyImg
-- :: forall (h :: Nat) (w :: Nat)
-- . (h ~ 300, w ~ 300)
-- => Mat (ShapeT [h, w]) ('S 4) ('S Word8)
-- fillPolyImg = exceptError $
-- withMatM (Proxy :: Proxy [h, w])
-- (Proxy :: Proxy 4)
-- (Proxy :: Proxy Word8)
-- transparent $ \imgM -> do
-- lift $ fillPoly imgM (rookPts w h) blue LineType_AA 0
-- where
-- h = fromInteger $ natVal (Proxy :: Proxy h)
-- w = fromInteger $ natVal (Proxy :: Proxy w)
--
--
--
-- OpenCV Sphinx doc
fillPoly :: (PrimMonad m, IsPoint2 point2 Int32, ToScalar color) => Mut (Mat ( 'S [height, width]) channels depth) (PrimState m) -> Vector (Vector (point2 Int32)) -> color -> LineType -> Int32 -> m ()
-- | Draws several polygonal curves
--
-- Example:
--
--
-- polylinesImg
-- :: forall (h :: Nat) (w :: Nat)
-- . (h ~ 300, w ~ 300)
-- => Mat (ShapeT [h, w]) ('S 4) ('S Word8)
-- polylinesImg = exceptError $
-- withMatM (Proxy :: Proxy [h, w])
-- (Proxy :: Proxy 4)
-- (Proxy :: Proxy Word8)
-- transparent $ \imgM -> do
-- lift $ polylines imgM (rookPts w h) True blue 2 LineType_AA 0
-- where
-- h = fromInteger $ natVal (Proxy :: Proxy h)
-- w = fromInteger $ natVal (Proxy :: Proxy w)
--
--
--
-- OpenCV Sphinx doc
polylines :: (PrimMonad m, IsPoint2 point2 Int32, ToScalar color) => Mut (Mat ( 'S [height, width]) channels depth) (PrimState m) -> Vector (Vector (point2 Int32)) -> Bool -> color -> Int32 -> LineType -> Int32 -> m ()
-- | Draws a line segment connecting two points.
--
-- Example:
--
--
-- lineImg :: Mat (ShapeT [200, 300]) ('S 4) ('S Word8)
-- lineImg = exceptError $
-- withMatM (Proxy :: Proxy [200, 300])
-- (Proxy :: Proxy 4)
-- (Proxy :: Proxy Word8)
-- transparent $ \imgM -> do
-- lift $ line imgM (V2 10 130 :: V2 Int32) (V2 190 40 :: V2 Int32) blue 5 LineType_AA 0
-- lift $ line imgM (V2 210 50 :: V2 Int32) (V2 250 180 :: V2 Int32) red 8 LineType_AA 0
--
--
--
-- OpenCV Sphinx doc
line :: (PrimMonad m, IsPoint2 fromPoint2 Int32, IsPoint2 toPoint2 Int32, ToScalar color) => Mut (Mat ( 'S [height, width]) channels depth) (PrimState m) -> fromPoint2 Int32 -> toPoint2 Int32 -> color -> Int32 -> LineType -> Int32 -> m ()
-- | Calculates the size of a box that contains the specified text
--
-- OpenCV Sphinx doc
getTextSize :: Text -> Font -> Int32 -> (Size2i, Int32)
-- | Draws a text string.
--
-- The function putText renders the specified text string in the image.
-- Symbols that cannot be rendered using the specified font are replaced
-- by question marks.
--
-- Example:
--
--
-- putTextImg :: Mat ('S ['D, 'S 400]) ('S 4) ('S Word8)
-- putTextImg = exceptError $
-- withMatM (height ::: (Proxy :: Proxy 400) ::: Z)
-- (Proxy :: Proxy 4)
-- (Proxy :: Proxy Word8)
-- transparent $ \imgM -> do
-- forM_ (zip [0..] [minBound .. maxBound]) $ \(n, fontFace) ->
-- lift $ putText imgM
-- (T.pack $ show fontFace)
-- (V2 10 (35 + n * 30) :: V2 Int32)
-- (Font fontFace NotSlanted 1.0)
-- black
-- 1
-- LineType_AA
-- False
-- where
-- height :: Int32
-- height = 50 + fromIntegral (30 * fromEnum (maxBound :: FontFace))
--
--
--
-- OpenCV Sphinx doc
putText :: (PrimMonad m, IsPoint2 point2 Int32, ToScalar color) => Mut (Mat ( 'S [height, width]) channels depth) (PrimState m) -> Text -> point2 Int32 -> Font -> color -> Int32 -> LineType -> Bool -> m ()
-- | Draws a simple, thick, or filled up-right rectangle
--
-- Example:
--
--
-- rectangleImg :: Mat (ShapeT [200, 400]) ('S 4) ('S Word8)
-- rectangleImg = exceptError $
-- withMatM (Proxy :: Proxy [200, 400])
-- (Proxy :: Proxy 4)
-- (Proxy :: Proxy Word8)
-- transparent $ \imgM -> do
-- lift $ rectangle imgM (toRect $ HRect (V2 10 10) (V2 180 180)) blue 5 LineType_8 0
-- lift $ rectangle imgM (toRect $ HRect (V2 260 30) (V2 80 140)) red (-1) LineType_8 0
--
--
--
-- OpenCV Sphinx doc
rectangle :: (PrimMonad m, ToScalar color, IsRect rect Int32) => Mut (Mat ( 'S [height, width]) channels depth) (PrimState m) -> rect Int32 -> color -> Int32 -> LineType -> Int32 -> m ()
-- | Draw contours onto a black image.
--
-- Example:
--
--
-- flowerContours :: Mat ('S ['S 512, 'S 768]) ('S 3) ('S Word8)
-- flowerContours = exceptError $
-- withMatM (Proxy :: Proxy [512,768])
-- (Proxy :: Proxy 3)
-- (Proxy :: Proxy Word8)
-- black $ \imgM -> do
-- edges <- thaw $ exceptError $
-- cvtColor bgr gray flower_768x512 >>=
-- canny 30 20 Nothing CannyNormL1
-- contours <- findContours ContourRetrievalList
-- ContourApproximationSimple edges
-- lift $ drawContours (V.map contourPoints contours)
-- red
-- (OutlineContour LineType_AA 1)
-- imgM
--
--
drawContours :: (ToScalar color, PrimMonad m) => Vector (Vector Point2i) -> color -> ContourDrawMode -> Mut (Mat ( 'S [h, w]) channels depth) (PrimState m) -> m ()
-- | Draws a marker on a predefined position in an image.
--
-- The marker will be drawn as as a 20-pixel cross.
--
-- Example:
--
--
-- markerImg :: Mat (ShapeT [100, 100]) ('S 4) ('S Word8)
-- markerImg = exceptError $
-- withMatM (Proxy :: Proxy [100, 100])
-- (Proxy :: Proxy 4)
-- (Proxy :: Proxy Word8)
-- transparent $ \imgM -> do
-- lift $ marker imgM (50 :: V2 Int32) blue
--
--
marker :: (PrimMonad m, IsPoint2 point2 Int32, ToScalar color) => Mut (Mat ( 'S '[height, width]) channels depth) (PrimState m) -> point2 Int32 -> color -> m ()
instance GHC.Show.Show OpenCV.ImgProc.Drawing.Font
instance GHC.Show.Show OpenCV.ImgProc.Drawing.FontSlant
instance GHC.Enum.Bounded OpenCV.ImgProc.Drawing.FontFace
instance GHC.Enum.Enum OpenCV.ImgProc.Drawing.FontFace
instance GHC.Show.Show OpenCV.ImgProc.Drawing.FontFace
instance GHC.Enum.Bounded OpenCV.ImgProc.Drawing.LineType
instance GHC.Enum.Enum OpenCV.ImgProc.Drawing.LineType
instance GHC.Show.Show OpenCV.ImgProc.Drawing.LineType
module OpenCV.ImgProc.ColorMaps
data ColorMap
ColorMapAutumn :: ColorMap
ColorMapBone :: ColorMap
ColorMapJet :: ColorMap
ColorMapWinter :: ColorMap
ColorMapRainbow :: ColorMap
ColorMapOcean :: ColorMap
ColorMapSummer :: ColorMap
ColorMapSpring :: ColorMap
ColorMapCool :: ColorMap
ColorMapHsv :: ColorMap
ColorMapPink :: ColorMap
ColorMapHot :: ColorMap
ColorMapParula :: ColorMap
-- | Applies a GNU Octave/MATLAB equivalent colormap on a given image
--
-- The human perception isn’t built for observing fine changes in
-- grayscale images. Human eyes are more sensitive to observing changes
-- between colors, so you often need to recolor your grayscale images to
-- get a clue about them. OpenCV now comes with various colormaps to
-- enhance the visualization in your computer vision application.
--
-- Example:
--
--
-- grayscaleImg
-- :: forall (height :: Nat) (width :: Nat) depth
-- . (height ~ 30, width ~ 256, depth ~ Word8)
-- => Mat (ShapeT [height, width]) ('S 1) ('S depth)
-- grayscaleImg = exceptError $
-- matFromFunc
-- (Proxy :: Proxy [height, width])
-- (Proxy :: Proxy 1)
-- (Proxy :: Proxy depth)
-- grayscale
-- where
-- grayscale :: [Int] -> Int -> Word8
-- grayscale [_y, x] 0 = fromIntegral x
-- grayscale _pos _channel = error "impossible"
--
-- type ColorMapImg = Mat (ShapeT [30, 256]) ('S 3) ('S Word8)
--
-- mkColorMapImg :: ColorMap -> ColorMapImg
-- mkColorMapImg cmap = exceptError $ applyColorMap cmap grayscaleImg
--
-- colorMapAutumImg :: ColorMapImg
-- colorMapBoneImg :: ColorMapImg
-- colorMapJetImg :: ColorMapImg
-- colorMapWinterImg :: ColorMapImg
-- colorMapRainbowImg :: ColorMapImg
-- colorMapOceanImg :: ColorMapImg
-- colorMapSummerImg :: ColorMapImg
-- colorMapSpringImg :: ColorMapImg
-- colorMapCoolImg :: ColorMapImg
-- colorMapHsvImg :: ColorMapImg
-- colorMapPinkImg :: ColorMapImg
-- colorMapHotImg :: ColorMapImg
-- colorMapParulaImg :: ColorMapImg
--
-- colorMapAutumImg = mkColorMapImg ColorMapAutumn
-- colorMapBoneImg = mkColorMapImg ColorMapBone
-- colorMapJetImg = mkColorMapImg ColorMapJet
-- colorMapWinterImg = mkColorMapImg ColorMapWinter
-- colorMapRainbowImg = mkColorMapImg ColorMapRainbow
-- colorMapOceanImg = mkColorMapImg ColorMapOcean
-- colorMapSummerImg = mkColorMapImg ColorMapSummer
-- colorMapSpringImg = mkColorMapImg ColorMapSpring
-- colorMapCoolImg = mkColorMapImg ColorMapCool
-- colorMapHsvImg = mkColorMapImg ColorMapHsv
-- colorMapPinkImg = mkColorMapImg ColorMapPink
-- colorMapHotImg = mkColorMapImg ColorMapHot
-- colorMapParulaImg = mkColorMapImg ColorMapParula
--
--
--
-- OpenCV Sphinx doc
applyColorMap :: ColorMap -> Mat shape ( 'S 1) ( 'S Word8) -> CvExcept (Mat shape ( 'S 3) ( 'S Word8))
module OpenCV.ImgProc.CascadeClassifier
data CascadeClassifier
-- | Create a new cascade classifier. Returns Nothing if the
-- classifier is empty after initialization. This usually means that the
-- file could not be loaded (e.g. it doesn't exist, is corrupt, etc.)
newCascadeClassifier :: FilePath -> IO (Maybe CascadeClassifier)
-- | Example:
--
--
-- cascadeClassifierArnold
-- :: forall (width :: Nat)
-- (height :: Nat)
-- (channels :: Nat)
-- (depth :: * )
-- . (Mat (ShapeT [height, width]) ('S channels) ('S depth) ~ Arnold_small)
-- => IO (Mat (ShapeT [height, width]) ('S channels) ('S depth))
-- cascadeClassifierArnold = do
-- -- Create two classifiers from data files.
-- Just ccFrontal <- newCascadeClassifier "data/haarcascade_frontalface_default.xml"
-- Just ccEyes <- newCascadeClassifier "data/haarcascade_eye.xml"
-- -- Detect some features.
-- let eyes = ccDetectMultiscale ccEyes arnoldGray
-- faces = ccDetectMultiscale ccFrontal arnoldGray
-- -- Draw the result.
-- pure $ exceptError $
-- withMatM (Proxy :: Proxy [height, width])
-- (Proxy :: Proxy channels)
-- (Proxy :: Proxy depth)
-- white $ \imgM -> do
-- void $ matCopyToM imgM (V2 0 0) arnold_small Nothing
-- forM_ eyes $ \eyeRect -> lift $ rectangle imgM eyeRect blue 2 LineType_8 0
-- forM_ faces $ \faceRect -> lift $ rectangle imgM faceRect green 2 LineType_8 0
-- where
-- arnoldGray = exceptError $ cvtColor bgr gray arnold_small
--
-- ccDetectMultiscale cc = cascadeClassifierDetectMultiScale cc Nothing Nothing minSize maxSize
--
-- minSize = Nothing :: Maybe (V2 Int32)
-- maxSize = Nothing :: Maybe (V2 Int32)
--
--
cascadeClassifierDetectMultiScale :: (IsSize size Int32) => CascadeClassifier -> Maybe Double -> Maybe Int32 -> Maybe (size Int32) -> Maybe (size Int32) -> Mat ( 'S [w, h]) ( 'S 1) ( 'S Word8) -> Vector (Rect Int32)
-- | Special version which returns bounding rectangle, rejectLevels, and
-- levelWeights
cascadeClassifierDetectMultiScaleNC :: (IsSize size Int32) => CascadeClassifier -> Maybe Double -> Maybe Int32 -> Maybe (size Int32) -> Maybe (size Int32) -> Mat ( 'S [w, h]) ( 'S 1) ( 'S Word8) -> Vector (Rect Int32, Int32, Double)
instance OpenCV.Internal.C.Types.WithPtr OpenCV.ImgProc.CascadeClassifier.CascadeClassifier
instance OpenCV.Internal.C.Types.FromPtr OpenCV.ImgProc.CascadeClassifier.CascadeClassifier
module OpenCV.Features2d
data Orb
data OrbScoreType
HarrisScore :: OrbScoreType
FastScore :: OrbScoreType
data WTA_K
WTA_K_2 :: WTA_K
WTA_K_3 :: WTA_K
WTA_K_4 :: WTA_K
data OrbParams
OrbParams :: !Int32 -> !Float -> !Int32 -> !Int32 -> !Int32 -> !WTA_K -> !OrbScoreType -> !Int32 -> !Int32 -> OrbParams
-- | The maximum number of features to retain.
[orb_nfeatures] :: OrbParams -> !Int32
-- | Pyramid decimation ratio, greater than 1. orb_scaleFactor == 2
-- means the classical pyramid, where each next level has 4x less pixels
-- than the previous, but such a big scale factor will degrade feature
-- matching scores dramatically. On the other hand, too close to 1 scale
-- factor will mean that to cover certain scale range you will need more
-- pyramid levels and so the speed will suffer.
[orb_scaleFactor] :: OrbParams -> !Float
-- | The number of pyramid levels. The smallest level will have linear size
-- equal to input_image_linear_size / orb_scaleFactor **
-- orb_nlevels.
[orb_nlevels] :: OrbParams -> !Int32
-- | This is size of the border where the features are not detected. It
-- should roughly match the patchSize parameter.
[orb_edgeThreshold] :: OrbParams -> !Int32
-- | It should be 0 in the current implementation.
[orb_firstLevel] :: OrbParams -> !Int32
-- | The number of points that produce each element of the oriented BRIEF
-- descriptor. The default value WTA_K_2 means the BRIEF where we
-- take a random point pair and compare their brightnesses, so we get 0/1
-- response. Other possible values are WTA_K_3 and WTA_K_4.
-- For example, WTA_K_3 means that we take 3 random points (of
-- course, those point coordinates are random, but they are generated
-- from the pre-defined seed, so each element of BRIEF descriptor is
-- computed deterministically from the pixel rectangle), find point of
-- maximum brightness and output index of the winner (0, 1 or 2). Such
-- output will occupy 2 bits, and therefore it will need a special
-- variant of Hamming distance, denoted as Norm_Hamming2 (2 bits
-- per bin). When WTA_K_4, we take 4 random points to compute each
-- bin (that will also occupy 2 bits with possible values 0, 1, 2 or 3).
[orb_WTA_K] :: OrbParams -> !WTA_K
-- | The default HarrisScore means that Harris algorithm is used to
-- rank features (the score is written to KeyPoint::score and is used to
-- retain best nfeatures features); FastScore is alternative value
-- of the parameter that produces slightly less stable keypoints, but it
-- is a little faster to compute.
[orb_scoreType] :: OrbParams -> !OrbScoreType
-- | Size of the patch used by the oriented BRIEF descriptor. Of course, on
-- smaller pyramid layers the perceived image area covered by a feature
-- will be larger.
[orb_patchSize] :: OrbParams -> !Int32
[orb_fastThreshold] :: OrbParams -> !Int32
defaultOrbParams :: OrbParams
mkOrb :: OrbParams -> Orb
-- | Detect keypoints and compute descriptors
--
-- Example:
--
--
-- orbDetectAndComputeImg
-- :: 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)
-- orbDetectAndComputeImg = exceptError $ do
-- (kpts, _descs) <- orbDetectAndCompute orb 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
-- orb = mkOrb defaultOrbParams
--
--
orbDetectAndCompute :: Orb -> Mat ( 'S [height, width]) channels depth -> Maybe (Mat ( 'S [height, width]) ( 'S 1) ( 'S Word8)) -> CvExcept (Vector KeyPoint, Mat 'D 'D 'D)
data SimpleBlobDetector
data SimpleBlobDetectorParams
SimpleBlobDetectorParams :: !Float -> !Float -> !Float -> !Int32 -> !Float -> !(Maybe BlobFilterByArea) -> !(Maybe BlobFilterByCircularity) -> !(Maybe BlobFilterByColor) -> !(Maybe BlobFilterByConvexity) -> !(Maybe BlobFilterByInertia) -> SimpleBlobDetectorParams
[blob_minThreshold] :: SimpleBlobDetectorParams -> !Float
[blob_maxThreshold] :: SimpleBlobDetectorParams -> !Float
[blob_thresholdStep] :: SimpleBlobDetectorParams -> !Float
[blob_minRepeatability] :: SimpleBlobDetectorParams -> !Int32
[blob_minDistBetweenBlobs] :: SimpleBlobDetectorParams -> !Float
-- | Extracted blobs have an area between minArea (inclusive) and
-- maxArea (exclusive).
[blob_filterByArea] :: SimpleBlobDetectorParams -> !(Maybe BlobFilterByArea)
-- | Extracted blobs have circularity (4 * pi * Area)/(perimeter *
-- perimeter) between minCircularity (inclusive) and
-- maxCircularity (exclusive).
[blob_filterByCircularity] :: SimpleBlobDetectorParams -> !(Maybe BlobFilterByCircularity)
-- | This filter compares the intensity of a binary image at the center of
-- a blob to blobColor. If they differ, the blob is filtered
-- out. Use blobColor = 0 to extract dark blobs and
-- blobColor = 255 to extract light blobs.
[blob_filterByColor] :: SimpleBlobDetectorParams -> !(Maybe BlobFilterByColor)
-- | Extracted blobs have convexity (area / area of blob convex hull)
-- between minConvexity (inclusive) and maxConvexity
-- (exclusive).
[blob_filterByConvexity] :: SimpleBlobDetectorParams -> !(Maybe BlobFilterByConvexity)
-- | Extracted blobs have this ratio between minInertiaRatio
-- (inclusive) and maxInertiaRatio (exclusive).
[blob_filterByInertia] :: SimpleBlobDetectorParams -> !(Maybe BlobFilterByInertia)
data BlobFilterByArea
BlobFilterByArea :: !Float -> !Float -> BlobFilterByArea
[blob_minArea] :: BlobFilterByArea -> !Float
[blob_maxArea] :: BlobFilterByArea -> !Float
data BlobFilterByCircularity
BlobFilterByCircularity :: !Float -> !Float -> BlobFilterByCircularity
[blob_minCircularity] :: BlobFilterByCircularity -> !Float
[blob_maxCircularity] :: BlobFilterByCircularity -> !Float
data BlobFilterByColor
BlobFilterByColor :: !Word8 -> BlobFilterByColor
[blob_blobColor] :: BlobFilterByColor -> !Word8
data BlobFilterByConvexity
BlobFilterByConvexity :: !Float -> !Float -> BlobFilterByConvexity
[blob_minConvexity] :: BlobFilterByConvexity -> !Float
[blob_maxConvexity] :: BlobFilterByConvexity -> !Float
data BlobFilterByInertia
BlobFilterByInertia :: !Float -> !Float -> BlobFilterByInertia
[blob_minInertiaRatio] :: BlobFilterByInertia -> !Float
[blob_maxInertiaRatio] :: BlobFilterByInertia -> !Float
defaultSimpleBlobDetectorParams :: SimpleBlobDetectorParams
mkSimpleBlobDetector :: SimpleBlobDetectorParams -> SimpleBlobDetector
-- | Detect keypoints and compute descriptors
blobDetect :: SimpleBlobDetector -> Mat ( 'S [height, width]) channels depth -> Maybe (Mat ( 'S [height, width]) ( 'S 1) ( 'S Word8)) -> CvExcept (Vector KeyPoint)
class DescriptorMatcher a
upcast :: DescriptorMatcher a => a -> BaseMatcher
add :: DescriptorMatcher a => a -> Vector (Mat 'D 'D 'D) -> IO ()
train :: DescriptorMatcher a => a -> IO ()
match :: DescriptorMatcher a => a -> Mat 'D 'D 'D -> Mat 'D 'D 'D -> Maybe (Mat ( 'S [height, width]) ( 'S 1) ( 'S Word8)) -> IO (Vector DMatch)
-- | Match in pre-trained matcher
match' :: DescriptorMatcher a => a -> Mat 'D 'D 'D -> Maybe (Mat ( 'S [height, width]) ( 'S 1) ( 'S Word8)) -> IO (Vector DMatch)
drawMatches :: Mat ( 'S [height, width]) channels depth -> Vector KeyPoint -> Mat ( 'S [height, width]) channels depth -> Vector KeyPoint -> Vector DMatch -> DrawMatchesParams -> CvExcept (Mat ( 'S [ 'D, 'D]) channels depth)
-- | Brute-force descriptor matcher
--
-- For each descriptor in the first set, this matcher finds the closest
-- descriptor in the second set by trying each one. This descriptor
-- matcher supports masking permissible matches of descriptor sets.
--
-- Example:
--
--
-- bfMatcherImg
-- :: forall (width :: Nat)
-- (width2 :: Nat)
-- (height :: Nat)
-- (channels :: Nat)
-- (depth :: *)
-- . ( Mat (ShapeT [height, width]) ('S channels) ('S depth) ~ Frog
-- , width2 ~ (*) width 2
-- )
-- => IO (Mat (ShapeT [height, width2]) ('S channels) ('S depth))
-- bfMatcherImg = do
-- let (kpts1, descs1) = exceptError $ orbDetectAndCompute orb frog Nothing
-- (kpts2, descs2) = exceptError $ orbDetectAndCompute orb rotatedFrog Nothing
--
-- bfmatcher <- newBFMatcher Norm_Hamming True
-- matches <- match bfmatcher
-- descs1 -- Query descriptors
-- descs2 -- Train descriptors
-- Nothing
-- exceptErrorIO $ pureExcept $
-- withMatM (Proxy :: Proxy [height, width2])
-- (Proxy :: Proxy channels)
-- (Proxy :: Proxy depth)
-- white $ \imgM -> do
-- matCopyToM imgM (V2 0 0) frog Nothing
-- matCopyToM imgM (V2 width 0) rotatedFrog Nothing
--
-- -- Draw the matches as lines from the query image to the train image.
-- forM_ matches $ \dmatch -> do
-- let matchRec = dmatchAsRec dmatch
-- queryPt = kpts1 V.! fromIntegral (dmatchQueryIdx matchRec)
-- trainPt = kpts2 V.! fromIntegral (dmatchTrainIdx matchRec)
-- queryPtRec = keyPointAsRec queryPt
-- trainPtRec = keyPointAsRec trainPt
--
-- -- We translate the train point one width to the right in order to
-- -- match the position of rotatedFrog in imgM.
-- line imgM
-- (round <$> kptPoint queryPtRec :: V2 Int32)
-- ((round <$> kptPoint trainPtRec :: V2 Int32) ^+^ V2 width 0)
-- blue 1 LineType_AA 0
-- where
-- orb = mkOrb defaultOrbParams {orb_nfeatures = 50}
--
-- width = fromInteger $ natVal (Proxy :: Proxy width)
--
-- rotatedFrog = exceptError $
-- warpAffine frog rotMat InterArea False False (BorderConstant black)
-- rotMat = getRotationMatrix2D (V2 250 195 :: V2 CFloat) 45 0.8
--
--
--
-- OpenCV Sphinx doc
data BFMatcher
newBFMatcher :: NormType -> Bool -> IO BFMatcher
-- | Flann-based descriptor matcher.
--
-- This matcher trains flann::Index_ on a train descriptor
-- collection and calls it nearest search methods to find the best
-- matches. So, this matcher may be faster when matching a large train
-- collection than the brute force matcher. FlannBasedMatcher
-- does not support masking permissible matches of descriptor sets
-- because flann::Index does not support this.
--
-- Example:
--
--
-- fbMatcherImg
-- :: forall (width :: Nat)
-- (width2 :: Nat)
-- (height :: Nat)
-- (channels :: Nat)
-- (depth :: *)
-- . ( Mat (ShapeT [height, width]) ('S channels) ('S depth) ~ Frog
-- , width2 ~ (*) width 2
-- )
-- => IO (Mat (ShapeT [height, width2]) ('S channels) ('S depth))
-- fbMatcherImg = do
-- let (kpts1, descs1) = exceptError $ orbDetectAndCompute orb frog Nothing
-- (kpts2, descs2) = exceptError $ orbDetectAndCompute orb rotatedFrog Nothing
--
-- fbmatcher <- newFlannBasedMatcher (def { indexParams = FlannLshIndexParams 20 10 2 })
-- matches <- match fbmatcher
-- descs1 -- Query descriptors
-- descs2 -- Train descriptors
-- Nothing
-- exceptErrorIO $ pureExcept $
-- withMatM (Proxy :: Proxy [height, width2])
-- (Proxy :: Proxy channels)
-- (Proxy :: Proxy depth)
-- white $ \imgM -> do
-- matCopyToM imgM (V2 0 0) frog Nothing
-- matCopyToM imgM (V2 width 0) rotatedFrog Nothing
--
-- -- Draw the matches as lines from the query image to the train image.
-- forM_ matches $ \dmatch -> do
-- let matchRec = dmatchAsRec dmatch
-- queryPt = kpts1 V.! fromIntegral (dmatchQueryIdx matchRec)
-- trainPt = kpts2 V.! fromIntegral (dmatchTrainIdx matchRec)
-- queryPtRec = keyPointAsRec queryPt
-- trainPtRec = keyPointAsRec trainPt
--
-- -- We translate the train point one width to the right in order to
-- -- match the position of rotatedFrog in imgM.
-- line imgM
-- (round <$> kptPoint queryPtRec :: V2 Int32)
-- ((round <$> kptPoint trainPtRec :: V2 Int32) ^+^ V2 width 0)
-- blue 1 LineType_AA 0
-- where
-- orb = mkOrb defaultOrbParams {orb_nfeatures = 50}
--
-- width = fromInteger $ natVal (Proxy :: Proxy width)
--
-- rotatedFrog = exceptError $
-- warpAffine frog rotMat InterArea False False (BorderConstant black)
-- rotMat = getRotationMatrix2D (V2 250 195 :: V2 CFloat) 45 0.8
--
--
--
-- OpenCV Sphinx doc
data FlannBasedMatcher
data FlannIndexParams
FlannKDTreeIndexParams :: Int -> FlannIndexParams
[trees] :: FlannIndexParams -> Int
FlannLshIndexParams :: Int -> Int -> Int -> FlannIndexParams
[tableNumber] :: FlannIndexParams -> Int
[keySize] :: FlannIndexParams -> Int
[multiProbeLevel] :: FlannIndexParams -> Int
data FlannSearchParams
FlannSearchParams :: Int -> Float -> Bool -> FlannSearchParams
[checks] :: FlannSearchParams -> Int
[eps] :: FlannSearchParams -> Float
[sorted] :: FlannSearchParams -> Bool
data FlannBasedMatcherParams
FlannBasedMatcherParams :: FlannIndexParams -> FlannSearchParams -> FlannBasedMatcherParams
[indexParams] :: FlannBasedMatcherParams -> FlannIndexParams
[searchParams] :: FlannBasedMatcherParams -> FlannSearchParams
newFlannBasedMatcher :: FlannBasedMatcherParams -> IO FlannBasedMatcher
instance GHC.Classes.Eq OpenCV.Features2d.BlobFilterByInertia
instance GHC.Classes.Eq OpenCV.Features2d.BlobFilterByConvexity
instance GHC.Classes.Eq OpenCV.Features2d.BlobFilterByColor
instance GHC.Classes.Eq OpenCV.Features2d.BlobFilterByCircularity
instance GHC.Classes.Eq OpenCV.Features2d.BlobFilterByArea
instance Data.Default.Class.Default OpenCV.Features2d.DrawMatchesParams
instance Data.Default.Class.Default OpenCV.Features2d.FlannBasedMatcherParams
instance Data.Default.Class.Default OpenCV.Features2d.FlannSearchParams
instance Data.Default.Class.Default OpenCV.Features2d.FlannIndexParams
instance OpenCV.Internal.C.Types.WithPtr OpenCV.Features2d.FlannBasedMatcher
instance OpenCV.Internal.C.Types.FromPtr OpenCV.Features2d.FlannBasedMatcher
instance OpenCV.Features2d.DescriptorMatcher OpenCV.Features2d.FlannBasedMatcher
instance OpenCV.Internal.C.Types.WithPtr OpenCV.Features2d.BFMatcher
instance OpenCV.Internal.C.Types.FromPtr OpenCV.Features2d.BFMatcher
instance OpenCV.Features2d.DescriptorMatcher OpenCV.Features2d.BFMatcher
instance OpenCV.Internal.C.Types.WithPtr OpenCV.Features2d.BaseMatcher
instance OpenCV.Internal.C.Types.WithPtr OpenCV.Features2d.SimpleBlobDetector
instance OpenCV.Internal.C.Types.FromPtr OpenCV.Features2d.SimpleBlobDetector
instance OpenCV.Internal.C.Types.WithPtr OpenCV.Features2d.Orb
instance OpenCV.Internal.C.Types.FromPtr OpenCV.Features2d.Orb
module OpenCV.Calib3d
data FundamentalMatMethod
FM_7Point :: FundamentalMatMethod
FM_8Point :: FundamentalMatMethod
FM_Ransac :: !(Maybe Double) -> !(Maybe Double) -> FundamentalMatMethod
FM_Lmeds :: !(Maybe Double) -> FundamentalMatMethod
data FindHomographyMethod
-- | A regular method using all the points.
FindHomographyMethod_0 :: FindHomographyMethod
-- | RANSAC-based robust method.
FindHomographyMethod_RANSAC :: FindHomographyMethod
-- | Least-Median robust method.
FindHomographyMethod_LMEDS :: FindHomographyMethod
-- | PROSAC-based robust method.
FindHomographyMethod_RHO :: FindHomographyMethod
data FindHomographyParams
FindHomographyParams :: !FindHomographyMethod -> !Double -> !Int -> !Double -> FindHomographyParams
[fhpMethod] :: FindHomographyParams -> !FindHomographyMethod
[fhpRansacReprojThreshold] :: FindHomographyParams -> !Double
[fhpMaxIters] :: FindHomographyParams -> !Int
[fhpConfidence] :: FindHomographyParams -> !Double
data WhichImage
Image1 :: WhichImage
Image2 :: WhichImage
-- | Calculates a fundamental matrix from the corresponding points in two
-- images
--
-- The minimum number of points required depends on the
-- FundamentalMatMethod.
--
--
--
-- With 7 points the FM_7Point method is used, despite the given
-- method.
--
-- With more than 7 points the FM_7Point method will be replaced
-- by the FM_8Point method.
--
-- Between 7 and 15 points the FM_Ransac method will be replaced
-- by the FM_Lmeds method.
--
-- With the FM_7Point method and with 7 points the result can
-- contain up to 3 matrices, resulting in either 3, 6 or 9 rows. This is
-- why the number of resulting rows in tagged as Dynamic. For all
-- other methods the result always contains 3 rows.
--
-- OpenCV Sphinx doc
findFundamentalMat :: (IsPoint2 point2 CDouble) => Vector (point2 CDouble) -> Vector (point2 CDouble) -> FundamentalMatMethod -> CvExcept (Maybe (Mat ( 'S '[ 'D, 'S 3]) ( 'S 1) ( 'S Double), Mat ( 'S '[ 'D, 'D]) ( 'S 1) ( 'S Word8)))
findHomography :: (IsPoint2 point2 CDouble) => Vector (point2 CDouble) -> Vector (point2 CDouble) -> FindHomographyParams -> CvExcept (Maybe (Mat ( 'S '[ 'S 3, 'S 3]) ( 'S 1) ( 'S Double), Mat ( 'S '[ 'D, 'D]) ( 'S 1) ( 'S Word8)))
-- | For points in an image of a stereo pair, computes the corresponding
-- epilines in the other image
--
-- OpenCV Sphinx doc
computeCorrespondEpilines :: (IsPoint2 point2 CDouble) => Vector (point2 CDouble) -> WhichImage -> Mat (ShapeT [3, 3]) ( 'S 1) ( 'S Double) -> CvExcept (Mat ( 'S [ 'D, 'S 1]) ( 'S 3) ( 'S Double))
instance GHC.Show.Show OpenCV.Calib3d.FindHomographyParams
instance GHC.Show.Show OpenCV.Calib3d.FindHomographyMethod
instance GHC.Classes.Eq OpenCV.Calib3d.WhichImage
instance GHC.Show.Show OpenCV.Calib3d.WhichImage
instance GHC.Classes.Eq OpenCV.Calib3d.FundamentalMatMethod
instance GHC.Show.Show OpenCV.Calib3d.FundamentalMatMethod
instance Data.Default.Class.Default OpenCV.Calib3d.FindHomographyParams
-- | Operations on arrays
module OpenCV.Core.ArrayOps
matScalarAdd :: (ToScalar scalar) => Mat shape channels depth -> scalar -> Mat shape channels depth
matScalarMult :: Mat shape channels depth -> Double -> Mat shape channels depth
-- | Calculates an absolute value of each matrix element.
--
-- OpenCV Sphinx doc
matAbs :: Mat shape channels depth -> Mat shape channels depth
-- | Calculates the per-element absolute difference between two arrays.
--
-- Example:
--
--
-- matAbsDiffImg :: Mat (ShapeT [341, 512]) ('S 3) ('S Word8)
-- matAbsDiffImg = matAbsDiff flower_512x341 sailboat_512x341
--
--
--
-- OpenCV Sphinx doc
matAbsDiff :: Mat shape channels depth -> Mat shape channels depth -> Mat shape channels depth
-- | Calculates the per-element sum of two arrays.
--
-- Example:
--
--
-- matAddImg :: Mat (ShapeT [341, 512]) ('S 3) ('S Word8)
-- matAddImg = matAdd flower_512x341 sailboat_512x341
--
--
--
-- OpenCV Sphinx doc
matAdd :: Mat shape channels depth -> Mat shape channels depth -> Mat shape channels depth
-- | Calculates the per-element difference between two arrays
--
-- Example:
--
--
-- matSubtractImg :: Mat (ShapeT [341, 512]) ('S 3) ('S Word8)
-- matSubtractImg = matSubtract flower_512x341 sailboat_512x341
--
--
--
-- OpenCV Sphinx doc
matSubtract :: Mat shape channels depth -> Mat shape channels depth -> Mat shape channels depth
-- | Calculates the weighted sum of two arrays
--
-- Example:
--
--
-- matAddWeightedImg :: Mat (ShapeT [341, 512]) ('S 3) ('S Word8)
-- matAddWeightedImg = exceptError $
-- matAddWeighted flower_512x341 0.5 sailboat_512x341 0.5 0.0
--
--
--
-- OpenCV Sphinx doc
matAddWeighted :: forall shape channels srcDepth dstDepth. (ToDepthDS (Proxy dstDepth)) => Mat shape channels srcDepth -> Double -> Mat shape channels srcDepth -> Double -> Double -> CvExcept (Mat shape channels dstDepth)
-- | Calculates the sum of a scaled array and another array.
--
-- The function scaleAdd is one of the classical primitive linear algebra
-- operations, known as DAXPY or SAXPY in BLAS. It calculates the sum of
-- a scaled array and another array.
--
-- OpenCV Sphinx doc
matScaleAdd :: Mat shape channels depth -> Double -> Mat shape channels depth -> CvExcept (Mat shape channels depth)
matMax :: Mat shape channels depth -> Mat shape channels depth -> CvExcept (Mat shape channels depth)
-- | Comparison type
data CmpType
Cmp_Eq :: CmpType
Cmp_Gt :: CmpType
Cmp_Ge :: CmpType
Cmp_Lt :: CmpType
Cmp_Le :: CmpType
Cmp_Ne :: CmpType
matScalarCompare :: Mat shape channels depth -> Double -> CmpType -> CvExcept (Mat shape channels depth)
-- | Example:
--
--
-- bitwiseNotImg :: Mat (ShapeT VennShape) ('S 3) ('S Word8)
-- bitwiseNotImg = exceptError $ do
-- img <- bitwiseNot vennCircleAImg
-- imgBgr <- cvtColor gray bgr img
-- createMat $ do
-- imgM <- lift $ thaw imgBgr
-- lift $ vennCircleA imgM blue 2
-- pure imgM
--
--
--
-- OpenCV Sphinx doc
bitwiseNot :: Mat shape channels depth -> CvExcept (Mat shape channels depth)
-- | Example:
--
--
-- bitwiseAndImg :: Mat (ShapeT VennShape) ('S 3) ('S Word8)
-- bitwiseAndImg = exceptError $ do
-- img <- bitwiseAnd vennCircleAImg vennCircleBImg
-- imgBgr <- cvtColor gray bgr img
-- createMat $ do
-- imgM <- lift $ thaw imgBgr
-- lift $ vennCircleA imgM blue 2
-- lift $ vennCircleB imgM red 2
-- pure imgM
--
--
--
-- OpenCV Sphinx doc
bitwiseAnd :: Mat shape channels depth -> Mat shape channels depth -> CvExcept (Mat shape channels depth)
-- | Example:
--
--
-- bitwiseOrImg :: Mat (ShapeT VennShape) ('S 3) ('S Word8)
-- bitwiseOrImg = exceptError $ do
-- img <- bitwiseOr vennCircleAImg vennCircleBImg
-- imgBgr <- cvtColor gray bgr img
-- createMat $ do
-- imgM <- lift $ thaw imgBgr
-- lift $ vennCircleA imgM blue 2
-- lift $ vennCircleB imgM red 2
-- pure imgM
--
--
--
-- OpenCV Sphinx doc
bitwiseOr :: Mat shape channels depth -> Mat shape channels depth -> CvExcept (Mat shape channels depth)
-- | Example:
--
--
-- bitwiseXorImg :: Mat (ShapeT VennShape) ('S 3) ('S Word8)
-- bitwiseXorImg = exceptError $ do
-- img <- bitwiseXor vennCircleAImg vennCircleBImg
-- imgBgr <- cvtColor gray bgr img
-- createMat $ do
-- imgM <- lift $ thaw imgBgr
-- lift $ vennCircleA imgM blue 2
-- lift $ vennCircleB imgM red 2
-- pure imgM
--
--
--
-- OpenCV Sphinx doc
bitwiseXor :: Mat shape channels depth -> Mat shape channels depth -> CvExcept (Mat shape channels depth)
-- | Creates one multichannel array out of several single-channel ones.
--
-- OpenCV Sphinx doc
matMerge :: Vector (Mat shape ( 'S 1) depth) -> Mat shape 'D depth
-- | Divides a multi-channel array into several single-channel arrays.
--
-- Example:
--
--
-- matSplitImg
-- :: forall (width :: Nat)
-- (width3 :: Nat)
-- (height :: Nat)
-- (channels :: Nat)
-- (depth :: *)
-- . ( Mat (ShapeT [height, width]) ('S channels) ('S depth) ~ Birds_512x341
-- , width3 ~ ((*) width 3)
-- )
-- => Mat (ShapeT [height, width3]) ('S channels) ('S depth)
-- matSplitImg = exceptError $ do
-- zeroImg <- mkMat (Proxy :: Proxy [height, width])
-- (Proxy :: Proxy 1)
-- (Proxy :: Proxy depth)
-- black
-- let blueImg = matMerge $ V.fromList [channelImgs V.! 0, zeroImg, zeroImg]
-- greenImg = matMerge $ V.fromList [zeroImg, channelImgs V.! 1, zeroImg]
-- redImg = matMerge $ V.fromList [zeroImg, zeroImg, channelImgs V.! 2]
--
-- withMatM (Proxy :: Proxy [height, width3])
-- (Proxy :: Proxy channels)
-- (Proxy :: Proxy depth)
-- white $ \imgM -> do
-- matCopyToM imgM (V2 (w*0) 0) (unsafeCoerceMat blueImg) Nothing
-- matCopyToM imgM (V2 (w*1) 0) (unsafeCoerceMat greenImg) Nothing
-- matCopyToM imgM (V2 (w*2) 0) (unsafeCoerceMat redImg) Nothing
-- where
-- channelImgs = matSplit birds_512x341
--
-- w :: Int32
-- w = fromInteger $ natVal (Proxy :: Proxy width)
--
--
--
-- OpenCV Sphinx doc
matSplit :: Mat shape channels depth -> Vector (Mat shape ( 'S 1) depth)
-- | Apply the same 1 dimensional action to every channel
matChannelMapM :: Monad m => (Mat shape ( 'S 1) depth -> m (Mat shape ( 'S 1) depth)) -> Mat shape channelsOut depth -> m (Mat shape channelsOut depth)
-- | Finds the global minimum and maximum in an array
--
-- OpenCV Sphinx doc
minMaxLoc :: Mat ( 'S [height, width]) channels depth -> CvExcept (Double, Double, Point2i, Point2i)
-- | Normalization type
data NormType
Norm_Inf :: NormType
Norm_L1 :: NormType
Norm_L2 :: NormType
Norm_L2SQR :: NormType
Norm_Hamming :: NormType
Norm_Hamming2 :: NormType
Norm_MinMax :: NormType
data NormAbsRel
NormRelative :: NormAbsRel
NormAbsolute :: NormAbsRel
-- | Calculates an absolute array norm
--
-- OpenCV Sphinx doc
norm :: NormType -> Maybe (Mat shape ( 'S 1) ( 'S Word8)) -> Mat shape channels depth -> CvExcept Double
-- | Calculates an absolute difference norm, or a relative difference norm
--
-- OpenCV Sphinx doc
normDiff :: NormAbsRel -> NormType -> Maybe (Mat shape ( 'S 1) ( 'S Word8)) -> Mat shape channels depth -> Mat shape channels depth -> CvExcept Double
-- | Normalizes the norm or value range of an array
--
-- OpenCV Sphinx doc
normalize :: forall shape channels srcDepth dstDepth. (ToDepthDS (Proxy dstDepth)) => Double -> Double -> NormType -> Maybe (Mat shape ( 'S 1) ( 'S Word8)) -> Mat shape channels srcDepth -> CvExcept (Mat shape channels dstDepth)
-- | Calculates the sum of array elements
--
-- Example:
--
--
-- matSumImg :: Mat (ShapeT [201, 201]) ('S 3) ('S Word8)
-- matSumImg = exceptError $
-- withMatM
-- (Proxy :: Proxy [201, 201])
-- (Proxy :: Proxy 3)
-- (Proxy :: Proxy Word8)
-- black $ \imgM -> do
-- -- Draw a filled circle. Each pixel has a value of (255,255,255)
-- lift $ circle imgM (pure radius :: V2 Int32) radius white (-1) LineType_8 0
-- -- Calculate the sum of all pixels.
-- scalar <- matSumM imgM
-- let V4 area _y _z _w = fromScalar scalar :: V4 Double
-- -- Circle area = pi * radius * radius
-- let approxPi = area / 255 / (radius * radius)
-- lift $ putText imgM
-- (T.pack $ show approxPi)
-- (V2 40 110 :: V2 Int32)
-- (Font FontHersheyDuplex NotSlanted 1)
-- blue
-- 1
-- LineType_AA
-- False
-- where
-- radius :: forall a. Num a => a
-- radius = 100
--
--
--
-- OpenCV Sphinx doc
matSum :: Mat shape channels depth -> CvExcept Scalar
matSumM :: (PrimMonad m) => Mut (Mat shape channels depth) (PrimState m) -> CvExceptT m Scalar
-- | Calculates a mean and standard deviation of array elements
--
-- OpenCV Sphinx doc
meanStdDev :: (1 <= channels, channels <= 4) => Mat shape ( 'S channels) depth -> Maybe (Mat shape ( 'S 1) ( 'S Word8)) -> CvExcept (Scalar, Scalar)
-- | Flips a 2D matrix around vertical, horizontal, or both axes.
--
-- The example scenarios of using the function are the following:
-- Vertical flipping of the image (FlipVertically) to switch
-- between top-left and bottom-left image origin. This is a typical
-- operation in video processing on Microsoft Windows* OS. Horizontal
-- flipping of the image with the subsequent horizontal shift and
-- absolute difference calculation to check for a vertical-axis symmetry
-- (FlipHorizontally). Simultaneous horizontal and vertical
-- flipping of the image with the subsequent shift and absolute
-- difference calculation to check for a central symmetry
-- (FlipBoth). Reversing the order of point arrays
-- (FlipHorizontally or FlipVertically).
--
-- Example:
--
--
-- matFlipImg :: Mat (ShapeT [341, 512]) ('S 3) ('S Word8)
-- matFlipImg = matFlip sailboat_512x341 FlipBoth
--
--
matFlip :: Mat ( 'S '[height, width]) channels depth -> FlipDirection -> Mat ( 'S '[height, width]) channels depth
data FlipDirection
-- | Flip around the x-axis.
FlipVertically :: FlipDirection
-- | Flip around the y-axis.
FlipHorizontally :: FlipDirection
-- | Flip around both x and y-axis.
FlipBoth :: FlipDirection
-- | Transposes a matrix.
--
-- Example:
--
--
-- matTransposeImg :: Mat (ShapeT [512, 341]) ('S 3) ('S Word8)
-- matTransposeImg = matTranspose sailboat_512x341
--
--
matTranspose :: Mat ( 'S '[height, width]) channels depth -> Mat ( 'S '[width, height]) channels depth
-- | Applies horizontal concatenation to given matrices.
--
-- Example:
--
--
-- hconcatImg :: Mat ('S '[ 'D, 'D ]) ('S 3) ('S Word8)
-- hconcatImg = exceptError $
-- hconcat $ V.fromList
-- [ halfSize birds_768x512
-- , halfSize flower_768x512
-- , halfSize sailboat_768x512
-- ]
-- where
-- halfSize = exceptError . resize (ResizeRel 0.5) InterArea
--
--
hconcat :: Vector (Mat ( 'S '[rows, 'D]) channels depth) -> CvExcept (Mat ( 'S '[rows, 'D]) channels depth)
-- | Applies vertical concatenation to given matrices.
--
-- Example:
--
--
-- vconcatImg :: Mat ('S '[ 'D, 'D ]) ('S 3) ('S Word8)
-- vconcatImg = exceptError $
-- vconcat $ V.fromList
-- [ halfSize birds_768x512
-- , halfSize flower_768x512
-- , halfSize sailboat_768x512
-- ]
-- where
-- halfSize = exceptError . resize (ResizeRel 0.5) InterArea
--
--
vconcat :: Vector (Mat ( 'S '[ 'D, cols]) channels depth) -> CvExcept (Mat ( 'S '[ 'D, cols]) channels depth)
-- | Performs the perspective matrix transformation of vectors.
--
-- TODO: Modify this function for accept 3D points TODO: Generalize
-- return type to V.Vector (point2 CDouble)
--
-- OpenCV Sphinx doc
perspectiveTransform :: (IsPoint2 point2 CDouble) => Vector (point2 CDouble) -> Mat ( 'S '[ 'S 3, 'S 3]) ( 'S 1) ( 'S Double) -> Vector Point2d
instance GHC.Classes.Eq OpenCV.Core.ArrayOps.FlipDirection
instance GHC.Show.Show OpenCV.Core.ArrayOps.FlipDirection
module OpenCV.Video
-- | Computes an optimal affine transformation between two 2D point sets
--
-- OpenCV Sphinx doc
estimateRigidTransform :: (IsPoint2 srcPoint2 Int32, IsPoint2 dstPoint2 Int32) => Vector (srcPoint2 Int32) -> Vector (dstPoint2 Int32) -> Bool -> CvExcept (Maybe (Mat (ShapeT [2, 3]) ( 'S 1) ( 'S Double)))
module OpenCV.Video.MotionAnalysis
class BackgroundSubtractor a
bgSubApply :: (BackgroundSubtractor a, (PrimMonad m)) => a (PrimState m) -> Double -> Mat ( 'S [h, w]) channels depth -> m (Mat ( 'S [h, w]) ( 'S 1) ( 'S Word8))
getBackgroundImage :: (BackgroundSubtractor a, (PrimMonad m)) => a (PrimState m) -> m (Mat ( 'S [h, w]) channels depth)
data BackgroundSubtractorMOG2 s
-- | Example:
--
--
-- carAnim :: Animation (ShapeT [240, 320]) ('S 3) ('S Word8)
-- carAnim = carOverhead
--
-- mog2Anim :: IO (Animation (ShapeT [240, 320]) ('S 3) ('S Word8))
-- mog2Anim = do
-- mog2 <- newBackgroundSubtractorMOG2 Nothing Nothing Nothing
-- forM carOverhead $ (delay, img) -> do
-- fg <- bgSubApply mog2 0.1 img
-- fgBgr <- exceptErrorIO $ pureExcept $ cvtColor gray bgr fg
-- pure (delay, fgBgr)
--
--
-- Original:
--
-- Foreground:
data BackgroundSubtractorKNN s
newBackgroundSubtractorKNN :: (PrimMonad m) => Maybe Int32 -> Maybe Double -> Maybe Bool -> m (BackgroundSubtractorKNN (PrimState m))
newBackgroundSubtractorMOG2 :: (PrimMonad m) => Maybe Int32 -> Maybe Double -> Maybe Bool -> m (BackgroundSubtractorMOG2 (PrimState m))
instance forall k (s :: k). OpenCV.Internal.C.Types.WithPtr (OpenCV.Video.MotionAnalysis.BackgroundSubtractorMOG2 s)
instance forall k (s :: k). OpenCV.Internal.C.Types.FromPtr (OpenCV.Video.MotionAnalysis.BackgroundSubtractorMOG2 s)
instance OpenCV.Core.Types.Algorithm OpenCV.Video.MotionAnalysis.BackgroundSubtractorMOG2
instance OpenCV.Video.MotionAnalysis.BackgroundSubtractor OpenCV.Video.MotionAnalysis.BackgroundSubtractorMOG2
instance forall k (s :: k). OpenCV.Internal.C.Types.WithPtr (OpenCV.Video.MotionAnalysis.BackgroundSubtractorKNN s)
instance forall k (s :: k). OpenCV.Internal.C.Types.FromPtr (OpenCV.Video.MotionAnalysis.BackgroundSubtractorKNN s)
instance OpenCV.Core.Types.Algorithm OpenCV.Video.MotionAnalysis.BackgroundSubtractorKNN
instance OpenCV.Video.MotionAnalysis.BackgroundSubtractor OpenCV.Video.MotionAnalysis.BackgroundSubtractorKNN
module OpenCV.VideoIO.Types
newtype FourCC
FourCC :: Int32 -> FourCC
[unFourCC] :: FourCC -> Int32
data VideoCaptureProperties
-- | Current position of the video file in milliseconds.
VideoCapPropPosMsec :: VideoCaptureProperties
-- | 0-based index of the frame to be decoded/captured next.
VideoCapPropPosFrames :: VideoCaptureProperties
-- | Relative position of the video file: 0=start of the film, 1=end of the
-- film.
VideoCapPropPosAviRatio :: VideoCaptureProperties
-- | Width of the frames in the video stream.
VideoCapPropFrameWidth :: VideoCaptureProperties
-- | Height of the frames in the video stream.
VideoCapPropFrameHeight :: VideoCaptureProperties
-- | Frame rate.
VideoCapPropFps :: VideoCaptureProperties
-- | 4-character code of codec.
VideoCapPropFourCc :: VideoCaptureProperties
-- | Number of frames in the video file.
VideoCapPropFrameCount :: VideoCaptureProperties
-- | Format of the Mat objects returned by VideoCapture::retrieve().
VideoCapPropFormat :: VideoCaptureProperties
-- | Backend-specific value indicating the current capture mode.
VideoCapPropMode :: VideoCaptureProperties
-- | Brightness of the image (only for cameras).
VideoCapPropBrightness :: VideoCaptureProperties
-- | Contrast of the image (only for cameras).
VideoCapPropContrast :: VideoCaptureProperties
-- | Saturation of the image (only for cameras).
VideoCapPropSaturation :: VideoCaptureProperties
-- | Hue of the image (only for cameras).
VideoCapPropHue :: VideoCaptureProperties
-- | Gain of the image (only for cameras).
VideoCapPropGain :: VideoCaptureProperties
-- | Exposure (only for cameras).
VideoCapPropExposure :: VideoCaptureProperties
-- | Boolean flags indicating whether images should be converted to RGB.
VideoCapPropConvertRgb :: VideoCaptureProperties
-- | Currently unsupported.
VideoCapPropWhiteBalanceBlueU :: VideoCaptureProperties
-- | Rectification flag for stereo cameras (note: only supported by DC1394
-- v 2.x backend currently).
VideoCapPropRectification :: VideoCaptureProperties
VideoCapPropMonochrome :: VideoCaptureProperties
VideoCapPropSharpness :: VideoCaptureProperties
-- | DC1394: exposure control done by camera, user can adjust reference
-- level using this feature.
VideoCapPropAutoExposure :: VideoCaptureProperties
VideoCapPropGamma :: VideoCaptureProperties
VideoCapPropTemperature :: VideoCaptureProperties
VideoCapPropTrigger :: VideoCaptureProperties
VideoCapPropTriggerDelay :: VideoCaptureProperties
VideoCapPropWhiteBalanceRedV :: VideoCaptureProperties
VideoCapPropZoom :: VideoCaptureProperties
VideoCapPropFocus :: VideoCaptureProperties
VideoCapPropGuid :: VideoCaptureProperties
VideoCapPropIsoSpeed :: VideoCaptureProperties
VideoCapPropBacklight :: VideoCaptureProperties
VideoCapPropPan :: VideoCaptureProperties
VideoCapPropTilt :: VideoCaptureProperties
VideoCapPropRoll :: VideoCaptureProperties
VideoCapPropIris :: VideoCaptureProperties
-- | Pop up video/camera filter dialog (note: only supported by DSHOW
-- backend currently. Property value is ignored)
VideoCapPropSettings :: VideoCaptureProperties
VideoCapPropBuffersize :: VideoCaptureProperties
VideoCapPropAutofocus :: VideoCaptureProperties
-- | Any property we need. Meaning of this property depends on the backend.
VideoCapPropInt :: !Int32 -> VideoCaptureProperties
data VideoCaptureAPI
-- | Auto detect == 0
VideoCapAny :: VideoCaptureAPI
-- | Video For Windows (platform native)
VideoCapVfw :: VideoCaptureAPI
-- | V4L/V4L2 capturing support via libv4l
VideoCapV4l :: VideoCaptureAPI
-- | Same as CAP_V4L
VideoCapV4l2 :: VideoCaptureAPI
-- | IEEE 1394 drivers
VideoCapFirewire :: VideoCaptureAPI
-- | Same as CAP_FIREWIRE
VideoCapFireware :: VideoCaptureAPI
-- | Same as CAP_FIREWIRE
VideoCapIeee1394 :: VideoCaptureAPI
-- | Same as CAP_FIREWIRE
VideoCapDc1394 :: VideoCaptureAPI
-- | Same as CAP_FIREWIRE
VideoCapCmu1394 :: VideoCaptureAPI
-- | QuickTime
VideoCapQt :: VideoCaptureAPI
-- | Unicap drivers
VideoCapUnicap :: VideoCaptureAPI
-- | DirectShow (via videoInput)
VideoCapDshow :: VideoCaptureAPI
-- | PvAPI, Prosilica GigE SDK
VideoCapPvapi :: VideoCaptureAPI
-- | OpenNI (for Kinect)
VideoCapOpenni :: VideoCaptureAPI
-- | OpenNI (for Asus Xtion)
VideoCapOpenniAsus :: VideoCaptureAPI
-- | Android - not used
VideoCapAndroid :: VideoCaptureAPI
-- | XIMEA Camera API
VideoCapXiapi :: VideoCaptureAPI
-- | AVFoundation framework for iOS (OS X Lion will have the same API)
VideoCapAvfoundation :: VideoCaptureAPI
-- | Smartek Giganetix GigEVisionSDK
VideoCapGiganetix :: VideoCaptureAPI
-- | Microsoft Media Foundation (via videoInput)
VideoCapMsmf :: VideoCaptureAPI
-- | Microsoft Windows Runtime using Media Foundation
VideoCapWinrt :: VideoCaptureAPI
-- | Intel Perceptual Computing SDK
VideoCapIntelperc :: VideoCaptureAPI
-- | OpenNI2 (for Kinect)
VideoCapOpenni2 :: VideoCaptureAPI
-- | OpenNI2 (for Asus Xtion and Occipital Structure sensors)
VideoCapOpenni2Asus :: VideoCaptureAPI
-- | gPhoto2 connection
VideoCapGphoto2 :: VideoCaptureAPI
-- | GStreamer
VideoCapGstreamer :: VideoCaptureAPI
-- | Open and record video file or stream using the FFMPEG library
VideoCapFfmpeg :: VideoCaptureAPI
-- | Image Sequence (e.g. img_%02d.jpg)
VideoCapImages :: VideoCaptureAPI
module OpenCV.VideoIO.VideoCapture
data VideoCapture
data VideoCaptureSource
-- | VideoFile and backend
VideoFileSource :: !FilePath -> !(Maybe VideoCaptureAPI) -> VideoCaptureSource
-- | VideoDevice and backend
VideoDeviceSource :: !Int32 -> !(Maybe VideoCaptureAPI) -> VideoCaptureSource
newVideoCapture :: IO VideoCapture
videoCaptureOpen :: VideoCapture -> VideoCaptureSource -> CvExceptT IO ()
videoCaptureRelease :: VideoCapture -> CvExceptT IO ()
videoCaptureIsOpened :: VideoCapture -> IO Bool
videoCaptureGrab :: VideoCapture -> IO Bool
videoCaptureRetrieve :: VideoCapture -> IO (Maybe (Mat ( 'S [ 'D, 'D]) 'D 'D))
videoCaptureGetD :: VideoCapture -> VideoCaptureProperties -> IO Double
videoCaptureGetI :: VideoCapture -> VideoCaptureProperties -> IO Int32
videoCaptureSetD :: VideoCapture -> VideoCaptureProperties -> Double -> IO Bool
videoCaptureSetI :: VideoCapture -> VideoCaptureProperties -> Int32 -> IO Bool
instance OpenCV.Internal.C.Types.WithPtr OpenCV.VideoIO.VideoCapture.VideoCapture
instance OpenCV.Internal.C.Types.FromPtr OpenCV.VideoIO.VideoCapture.VideoCapture
module OpenCV
-- | A thin JuicyPixels layer.
module OpenCV.Juicy
-- | An OpenCV bidimensional matrix
type Mat2D h w channels depth = Mat ( 'S '[h, w]) channels depth
-- | An OpenCV 2D-filter preserving the matrix type
type Filter m h w c d = Mat2D h w c d -> CvExceptT m (Mat2D h w c d)
-- | map Pixel types to a number of channels
-- | map Pixel types to a depth
-- | Compute an OpenCV 2D-matrix from a JuicyPixels image.
--
-- Example:
--
--
-- fromImageImg :: IO (Mat ('S '[ 'D, 'D]) ('S 3) ('S Word8))
-- fromImageImg = do
-- r <- Codec.Picture.readImage "data/Lenna.png"
-- case r of
-- Left err -> error err
-- Right (Codec.Picture.ImageRGB8 img) -> pure $ OpenCV.Juicy.fromImage img
-- Right _ -> error "Unhandled JuicyPixels format!"
--
--
fromImage :: forall a c d. (ToDepth (Proxy d), KnownNat c, Pixel a, Storable a, c ~ PixelChannels a, d ~ PixelDepth a) => Image a -> Mat2D 'D 'D ( 'S c) ( 'S d)
-- | Compute a JuicyPixels image from an OpenCV 2D-matrix
--
-- FIXME: There's a bug in the colour conversions in the example:
--
-- Example:
--
--
-- toImageImg :: IO (Mat ('S '[ 'D, 'D]) ('S 3) ('S Word8))
-- toImageImg = exceptError . cvtColor rgb bgr . from . to . exceptError . cvtColor bgr rgb <$> fromImageImg
-- where
-- to :: OpenCV.Juicy.Mat2D 'D 'D ('S 3) ('S Word8) -> Codec.Picture.Image Codec.Picture.PixelRGB8
-- to = OpenCV.Juicy.toImage
--
-- from :: Codec.Picture.Image Codec.Picture.PixelRGB8 -> OpenCV.Juicy.Mat2D 'D 'D ('S 3) ('S Word8)
-- from = OpenCV.Juicy.fromImage
--
--
toImage :: forall a c d h w. (KnownNat c, Pixel a, Storable a, c ~ PixelChannels a, d ~ PixelDepth a) => Mat2D h w ( 'S c) ( 'S d) -> Image a
-- | Apply an OpenCV 2D-filter to a JuicyPixels dynamic matrix, preserving
-- the Juicy pixel encoding
isoJuicy :: forall m. (PrimMonad m) => (forall c d h w. Filter m h w c d) -> DynamicImage -> CvExceptT m DynamicImage
instance Foreign.Storable.Storable Codec.Picture.Types.PixelRGB8
instance Foreign.Storable.Storable Codec.Picture.Types.PixelRGB16
instance Foreign.Storable.Storable Codec.Picture.Types.PixelRGBF
instance Foreign.Storable.Storable Codec.Picture.Types.PixelRGBA8
instance Foreign.Storable.Storable Codec.Picture.Types.PixelRGBA16
instance Foreign.Storable.Storable Codec.Picture.Types.PixelYA8
instance Foreign.Storable.Storable Codec.Picture.Types.PixelYA16
module OpenCV.VideoIO.VideoWriter
data VideoWriter
data VideoWriterSink
VideoFileSink' :: !VideoFileSink -> VideoWriterSink
data VideoFileSink
VideoFileSink :: !FilePath -> !FourCC -> !Double -> !(Int32, Int32) -> VideoFileSink
[vfsFilePath] :: VideoFileSink -> !FilePath
[vfsFourCC] :: VideoFileSink -> !FourCC
[vfsFps] :: VideoFileSink -> !Double
[vfsFrameDims] :: VideoFileSink -> !(Int32, Int32)
-- | The API might change in the future, but currently we can:
--
-- Open/create a new file:
--
-- -- wr <- videoWriterOpen $ VideoFileSink' -- (VideoFileSink -- "tst.MOV" -- "avc1" -- 30 -- (3840, 2160) -- ) ---- -- Now, we can write some frames, but they need to have exactly the same -- size as the one we have opened with: -- --
-- exceptErrorIO $ videoWriterWrite wr img ---- -- We need to close at the end or it will not finalize the file: -- --
-- exceptErrorIO $ videoWriterRelease wr --videoWriterOpen :: VideoWriterSink -> IO VideoWriter videoWriterRelease :: VideoWriter -> CvExceptT IO () videoWriterIsOpened :: VideoWriter -> IO Bool videoWriterWrite :: VideoWriter -> Mat ( 'S [ 'D, 'D]) 'D 'D -> CvExceptT IO () instance OpenCV.Internal.C.Types.WithPtr OpenCV.VideoIO.VideoWriter.VideoWriter instance OpenCV.Internal.C.Types.FromPtr OpenCV.VideoIO.VideoWriter.VideoWriter