本文整理了Java中org.opencv.imgproc.Imgproc.floodFill()
方法的一些代码示例,展示了Imgproc.floodFill()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Imgproc.floodFill()
方法的具体详情如下:
包路径:org.opencv.imgproc.Imgproc
类名称:Imgproc
方法名:floodFill
[英]Fills a connected component with the given color.
The functions floodFill
fill a connected component starting from the seed point with the specified color. The connectivity is determined by the color/brightness closeness of the neighbor pixels. The pixel at (x,y) is considered to belong to the repainted domain if:
in case of a grayscale image and floating range
in case of a grayscale image and fixed range
src(x',y')_g- loDiff _g
and
src(x',y')_b- loDiff _b
in case of a color image and floating range
src(seedPoint.x, seedPoint.y)_g- loDiff _g
and
src(seedPoint.x, seedPoint.y)_b- loDiff _b
in case of a color image and fixed range
where src(x',y') is the value of one of pixel neighbors that is already known to belong to the component. That is, to be added to the connected component, a color/brightness of the pixel should be close enough to:
Use these functions to either mark a connected component with the specified color in-place, or build a mask and then extract the contour, or copy the region to another image, and so on.
Note:
floodFill
使用指定的颜色从种子点开始填充连接的组件。连通性由相邻像素的颜色/亮度接近度决定。如果满足以下条件,则认为*(x,y)*处的像素属于重绘域:代码示例来源:origin: openpnp/openpnp
public FluentCv floodFill(Point seedPoint, Color color, String... tag) {
Mat mask = new Mat();
Imgproc.floodFill(mat, mask, seedPoint, colorToScalar(color));
return store(mat, tag);
}
代码示例来源:origin: JavaOpenCVBook/code
int area = 0;
if(masked){
area = Imgproc.floodFill(image, mask, seedPoint, newVal, rect, lowerDifference,
upperDifference, flags);
area = Imgproc.floodFill(image, new Mat(), seedPoint, newVal, rect, lowerDifference,
upperDifference, flags);
代码示例来源:origin: JavaOpenCVBook/code
int area = 0;
if(masked){
area = Imgproc.floodFill(image, mask, seedPoint, newVal, rect, lowerDifference,
upperDifference, flags);
area = Imgproc.floodFill(image, new Mat(), seedPoint, newVal, rect, lowerDifference,
upperDifference, flags);
内容来源于网络,如有侵权,请联系作者删除!