| Cv2FindContours Method (InputOutputArray, Mat, OutputArray, RetrievalModes, ContourApproximationModes, NullablePoint) |
Finds contours in a binary image.
Namespace:
OpenCvSharp
Assembly:
OpenCvSharp (in OpenCvSharp.dll) Version: 1.0.0
Syntax public static void FindContours(
InputOutputArray image,
out Mat[] contours,
OutputArray hierarchy,
RetrievalModes mode,
ContourApproximationModes method,
Nullable<Point> offset = null
)
Public Shared Sub FindContours (
image As InputOutputArray,
<OutAttribute> ByRef contours As Mat(),
hierarchy As OutputArray,
mode As RetrievalModes,
method As ContourApproximationModes,
Optional offset As Nullable(Of Point) = Nothing
)
public:
static void FindContours(
InputOutputArray^ image,
[OutAttribute] array<Mat^>^% contours,
OutputArray^ hierarchy,
RetrievalModes mode,
ContourApproximationModes method,
Nullable<Point> offset = nullptr
)
static member FindContours :
image : InputOutputArray *
contours : Mat[] byref *
hierarchy : OutputArray *
mode : RetrievalModes *
method : ContourApproximationModes *
?offset : Nullable<Point>
(* Defaults:
let _offset = defaultArg offset null
*)
-> unit
Parameters
- image
- Type: OpenCvSharpInputOutputArray
Source, an 8-bit single-channel image. Non-zero pixels are treated as 1’s.
Zero pixels remain 0’s, so the image is treated as binary.
The function modifies the image while extracting the contours. - contours
- Type: OpenCvSharpMat
Detected contours. Each contour is stored as a vector of points. - hierarchy
- Type: OpenCvSharpOutputArray
Optional output vector, containing information about the image topology.
It has as many elements as the number of contours. For each i-th contour contours[i],
the members of the elements hierarchy[i] are set to 0-based indices in contours of the next
and previous contours at the same hierarchical level, the first child contour and the parent contour, respectively.
If for the contour i there are no next, previous, parent, or nested contours, the corresponding elements of hierarchy[i] will be negative. - mode
- Type: OpenCvSharpRetrievalModes
Contour retrieval mode - method
- Type: OpenCvSharpContourApproximationModes
Contour approximation method - offset (Optional)
- Type: SystemNullablePoint
Optional offset by which every contour point is shifted.
This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context.
See Also