帮我生成一段可以填充轮廓内部的代码,基于opencv c++
时间: 2024-05-14 19:13:09 浏览: 88
Sure, I can generate some code for you to fill contours in OpenCV C. Here's a sample code:
```
void fillContours(Mat& img, vector<vector<Point>> contours)
{
vector<Vec4i> hierarchy;
for (int i = 0; i < contours.size(); i++)
{
drawContours(img, contours, i, Scalar(255), CV_FILLED, 8, hierarchy);
}
}
```
This function will take an OpenCV Mat object and a vector of contours as input and fill the contours with white color. You can use this code as a reference and modify it according to your specific requirements. Let me know if you have any other question!
阅读全文