Safe Haskell | None |
---|---|
Language | Haskell2010 |
- contourArea :: IsPoint2 point2 CFloat => Vector (point2 CFloat) -> ContourAreaOriented -> CvExcept Double
- pointPolygonTest :: (IsPoint2 contourPoint2 CFloat, IsPoint2 testPoint2 CFloat) => Vector (contourPoint2 CFloat) -> testPoint2 CFloat -> Bool -> CvExcept Double
- findContours :: PrimMonad m => ContourRetrievalMode -> ContourApproximationMethod -> Mut (Mat (S [h, w]) (S 1) (S Word8)) (PrimState m) -> m (Vector Contour)
- data Contour = Contour {
- contourPoints :: !(Vector Point2i)
- contourChildren :: !(Vector Contour)
- data ContourAreaOriented
- data ContourRetrievalMode
- data ContourApproximationMethod
- approxPolyDP :: IsPoint2 point2 Int32 => Vector (point2 Int32) -> Double -> Bool -> Vector Point2i
- arcLength :: IsPoint2 point2 Int32 => Vector (point2 Int32) -> Bool -> CvExcept Double
- minAreaRect :: IsPoint2 point2 Int32 => Vector (point2 Int32) -> RotatedRect
Documentation
:: IsPoint2 point2 CFloat | |
=> Vector (point2 CFloat) | Input vector of 2D points (contour vertices). |
-> ContourAreaOriented | Signed or unsigned area |
-> CvExcept Double |
Calculates a contour area.
The function computes a contour area. Similarly to moments
, the area is
computed using the Green formula.
Thus, the returned area and the number of non-zero pixels, if you draw the
contour using drawContours
or fillPoly
, can be different. Also, the function
will most certainly give a wrong results for contours with self-intersections.
:: (IsPoint2 contourPoint2 CFloat, IsPoint2 testPoint2 CFloat) | |
=> Vector (contourPoint2 CFloat) | Contour. |
-> testPoint2 CFloat | Point tested against the contour. |
-> Bool | If true, the function estimates the signed distance from the point to the nearest contour edge. Otherwise, the function only checks if the point is inside a contour or not. |
-> CvExcept Double |
Performs a point-in-contour test.
The function determines whether the point is inside a contour, outside, or lies on an edge (or coincides with a vertex). It returns positive (inside), negative (outside), or zero (on an edge) value, correspondingly. When measureDist=false , the return value is +1, -1, and 0, respectively. Otherwise, the return value is a signed distance between the point and the nearest contour edge.
findContours :: PrimMonad m => ContourRetrievalMode -> ContourApproximationMethod -> Mut (Mat (S [h, w]) (S 1) (S Word8)) (PrimState m) -> m (Vector Contour) Source #
Contour | |
|
data ContourAreaOriented Source #
Oriented area flag.
ContourAreaOriented | Return a signed area value, depending on the contour orientation (clockwise or counter-clockwise). Using this feature you can determine orientation of a contour by taking the sign of an area. |
ContourAreaAbsoluteValue | Return the area as an absolute value. |
data ContourRetrievalMode Source #
ContourRetrievalExternal | Retrieves only the extreme outer contours. |
ContourRetrievalList | Retrieves all of the contours without establishing any hierarchical relationships. |
ContourRetrievalCComp | Retrieves all of the contours and organizes them into a two-level hierarchy. At the top level, there are external boundaries of the components. At the second level, there are boundaries of the holes. If there is another contour inside a hole of a connected component, it is still put at the top level. |
ContourRetrievalTree | Retrieves all of the contours and reconstructs a full hierarchy of nested contours. |
data ContourApproximationMethod Source #
ContourApproximationNone | Stores absolutely all the contour points. That is, any 2 subsequent points |
ContourApproximationSimple | Compresses horizontal, vertical, and diagonal segments and leaves only their end points. For example, an up-right rectangular contour is encoded with 4 points. |
ContourApproximationTC89L1 | |
ContourApproximationTC89KCOS |
Approximates a polygonal curve(s) with the specified precision.
The functions approxPolyDP approximate a curve or a polygon with another curve/polygon with less vertices so that the distance between them is less or equal to the specified precision. It uses the Douglas-Peucker algorithm
minAreaRect :: IsPoint2 point2 Int32 => Vector (point2 Int32) -> RotatedRect Source #