函数原型
//版本一
int floodFill(InputOutputArray image, InputOutputArray mask, Point seedPoint,Scalar newVal,Rect*rect=0,Scalar loDiff = Scalar(), int flags=4)
//版本二
int floodFill(InputOutputArray image, InputOutputArray mask, Point seedPoint,Scalar newVal,Rect*rect=0,Scalar loDiff = Scalar(), int flags=4)
两个版本除第二个参数外,其他参数共用。
#include
#include
#include
using namespace cv;
int main()
{
Mat src = imread("1.jpg");
imshow("[原图]", src);
Rect ccomp;
floodFill(src, Point(50, 300), Scalar(155, 255, 55), &ccomp, Scalar(20, 20, 20), Scalar(20, 20, 20));
imshow("[效果图]", src);
waitKey(0);
return 0;
}
函数原型
void resize(InputArray src,OutputArray dst,Size dsize,double fx = 0,double fy = 0,int interpolation = INTER_LINEAR)
可选插值方式:
#include
#include
#include
using namespace cv;
int main()
{
Mat srcImage = imread("1.jpg");
Mat tmpImage, dstImage1, dstImage2;
tmpImage = srcImage;
imshow("[原图]", srcImage);
resize(tmpImage, dstImage1, Size(tmpImage.cols / 2, tmpImage.rows / 2), (0, 0),(0,0),3);
resize(tmpImage, dstImage2, Size(tmpImage.cols * 2, tmpImage.rows * 2), (0, 0), (0, 0), 3);
imshow("[效果图]一", dstImage1);
imshow("[效果图]二", dstImage2);
waitKey(0);
return 0;
}
向上采样:pyrUp()函数
函数原型
void pyrUp(inputArray src, OutputArray dst, const Size&dstsize = Size(),int borderType = BORDER)DEFAULT)
#include
#include
#include
using namespace cv;
int main()
{
Mat srcImage = imread("1.jpg");
Mat tmpImage, dstImage;
tmpImage = srcImage;
imshow("[原图]", srcImage);
pyrUp(tmpImage, dstImage, Size(tmpImage.cols * 2,tmpImage.rows*2));
imshow("[效果图]", dstImage);
waitKey(0);
return 0;
}
向下采样:pytDown()函数
函数原型
void pyrDown(intputArray src , OutputArray dst, const Size&dstsize = Size(), int borderType = BORDER_DEFAULT)
`#include
#include
#include
using namespace cv;
int main()
{
Mat srcImage = imread(“1.jpg”);
Mat tmpImage, dstImage;
tmpImage = srcImage;
imshow("[原图]", srcImage);
pyrDown(tmpImage, dstImage, Size(tmpImage.cols / 2,tmpImage.rows/2));
imshow("[效果图]", dstImage);
waitKey(0);
return 0;