drawContours function
void
drawContours(})
Implementation
void drawContours(
VARP img,
List<List<Point>> contours,
int contourIdx,
Scalar color, {
int thickness = 1,
int lineType = LINE_8,
}) {
final pContours = malloc<ffi.Pointer<c.mnn_cv_point_t>>(contours.length);
final pInnerLength = malloc<ffi.Int32>(contours.length);
pInnerLength.asTypedList(contours.length).setAll(0, contours.map((e) => e.length));
for (int i = 0; i < contours.length; i++) {
final pContour = malloc<c.mnn_cv_point_t>(contours[i].length);
for (int j = 0; j < contours[i].length; j++) {
pContour[j] = contours[i][j].ref;
}
pContours[i] = pContour;
}
c.mnn_cv_drawContours(
img.ptr,
pContours,
pInnerLength.cast(),
contours.length,
contourIdx,
color.ref,
thickness,
lineType,
);
for (int i = 0; i < contours.length; i++) {
malloc.free(pContours[i]);
}
malloc.free(pContours);
malloc.free(pInnerLength);
}