#include<cv.h>
#include<highgui.h>
int main(int argc, char** argv)
{
IplImage* img = cvLoadImage(argv[1]);
cvNamedWindow("原图", CV_WINDOW_AUTOSIZE);
cvShowImage("原图", img);
cvFloodFill(img, CvPoint(20, 20), CvScalar(0, 255, 0), CvScalar(20, 30, 40), CvScalar(20, 30, 40),NULL,4,NULL);
cvNamedWindow("漫水填充算法", CV_WINDOW_AUTOSIZE);
cvShowImage("漫水填充算法", img);
cvWaitKey(0);
cvReleaseImage(&img);
cvDestroyWindow("漫水填充算法");
}
参数是随意设置的,将就看看。。
结果展示: