首页 > 代码库 > 水漫填充

水漫填充

水漫填充:floodFill()函数

int floodFill( InputOutputArray image, InputOutputArray mask,
                            Point seedPoint, Scalar newVal, CV_OUT Rect* rect=0,
                            Scalar loDiff = Scalar(), Scalar upDiff = Scalar(),
                            int flags = 4 );
int floodFill( InputOutputArray image,
                          Point seedPoint, Scalar newVal, CV_OUT Rect* rect = 0,
                          Scalar loDiff = Scalar(), Scalar upDiff = Scalar(),
                          int flags = 4 );

技术分享

技术分享

技术分享

 1 #include<opencv2/opencv.hpp>
 2 #include<iostream>
 3 
 4 using namespace cv;
 5 using namespace std;
 6 
 7 int main(int argc, char** argv) {
 8     Mat img = imread("C:\\Users\\Nelsoner\\Desktop\\Camera Roll\\05.jpg", 1);
 9     Rect ccomp;
10     imshow("【原图】", img);
11     floodFill(img, Point(50, 300), Scalar(155, 255, 55), &ccomp, Scalar(20, 20, 20), Scalar(20, 20, 20));
12     imshow("【效果图】", img);
13 
14     waitKey(0);
15 
16     return 0;
17 }

 

技术分享

 

水漫填充