Table of Contents

Method DrawContours

Namespace
OpenCvSharp
Assembly
OpenCvSharp.dll

DrawContours(InputOutputArray, IEnumerable<IEnumerable<Point>>, int, Scalar, int, LineTypes, IEnumerable<HierarchyIndex>?, int, Point?)

draws contours in the image

public static void DrawContours(InputOutputArray image, IEnumerable<IEnumerable<Point>> contours, int contourIdx, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, IEnumerable<HierarchyIndex>? hierarchy = null, int maxLevel = 2147483647, Point? offset = null)

Parameters

image InputOutputArray

Destination image.

contours IEnumerable<IEnumerable<Point>>

All the input contours. Each contour is stored as a point vector.

contourIdx int

Parameter indicating a contour to draw. If it is negative, all the contours are drawn.

color Scalar

Color of the contours.

thickness int

Thickness of lines the contours are drawn with. If it is negative (for example, thickness=CV_FILLED ), the contour interiors are drawn.

lineType LineTypes

Line connectivity.

hierarchy IEnumerable<HierarchyIndex>

Optional information about hierarchy. It is only needed if you want to draw only some of the contours

maxLevel int

Maximal level for drawn contours. If it is 0, only the specified contour is drawn. If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function draws the contours, all the nested contours, all the nested-to-nested contours, and so on. This parameter is only taken into account when there is hierarchy available.

offset Point?

Optional contour shift parameter. Shift all the drawn contours by the specified offset = (dx, dy)

DrawContours(InputOutputArray, IEnumerable<Mat>, int, Scalar, int, LineTypes, InputArray, int, Point?)

draws contours in the image

public static void DrawContours(InputOutputArray image, IEnumerable<Mat> contours, int contourIdx, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, InputArray hierarchy = default, int maxLevel = 2147483647, Point? offset = null)

Parameters

image InputOutputArray

Destination image.

contours IEnumerable<Mat>

All the input contours. Each contour is stored as a point vector.

contourIdx int

Parameter indicating a contour to draw. If it is negative, all the contours are drawn.

color Scalar

Color of the contours.

thickness int

Thickness of lines the contours are drawn with. If it is negative (for example, thickness=CV_FILLED ), the contour interiors are drawn.

lineType LineTypes

Line connectivity.

hierarchy InputArray

Optional information about hierarchy. It is only needed if you want to draw only some of the contours

maxLevel int

Maximal level for drawn contours. If it is 0, only the specified contour is drawn. If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function draws the contours, all the nested contours, all the nested-to-nested contours, and so on. This parameter is only taken into account when there is hierarchy available.

offset Point?

Optional contour shift parameter. Shift all the drawn contours by the specified offset = (dx, dy)