org.opencv.imgproc.Imgproc.erode()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(230)

本文整理了Java中org.opencv.imgproc.Imgproc.erode()方法的一些代码示例,展示了Imgproc.erode()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Imgproc.erode()方法的具体详情如下:
包路径:org.opencv.imgproc.Imgproc
类名称:Imgproc
方法名:erode

Imgproc.erode介绍

[英]Erodes an image by using a specific structuring element.

The function erodes the source image using the specified structuring element that determines the shape of a pixel neighborhood over which the minimum is taken:

dst(x,y) = min _((x',y'): element(x',y') != 0) src(x+x',y+y')

The function supports the in-place mode. Erosion can be applied several (iterations) times. In case of multi-channel images, each channel is processed independently.

Note:

  • An example using the morphological erode operation can be found at opencv_source_code/samples/cpp/morphology2.cpp
    [中]通过使用特定的结构元素来腐蚀图像。
    该函数使用指定的结构元素侵蚀源图像,该结构元素确定像素邻域的形状,在该邻域上取最小值:
    dst(x,y)=最小值((x',y'):元素(x',y')!=0)src(x+x',y+y')
    该功能支持就地模式。侵蚀可以应用多次(iterations)。在多通道图像的情况下,每个通道独立处理。
    注:
    *使用形态学腐蚀操作的示例可在opencv_源代码/samples/cpp/morphology2中找到。cpp

代码示例

代码示例来源:origin: ytai/IOIOPlotter

private void HitAndMiss(Mat src, Mat dst, Mat positive, Mat negative) {
  Imgproc.erode(src, dst, positive);
  Core.subtract(Mat.ones(src.size(), CvType.CV_8UC1), src, tmpMat_);
  Imgproc.erode(tmpMat_, tmpMat_, negative);
  Core.bitwise_and(tmpMat_, dst, dst);
}

代码示例来源:origin: JavaOpenCVBook/code

public Mat erode(Mat input, int elementSize, int elementShape){
  Mat outputImage = new Mat();
  Mat element = getKernelFromShape(elementSize, elementShape);
  Imgproc.erode(input,outputImage, element);
  return outputImage;
}

代码示例来源:origin: JavaOpenCVBook/code

public Mat erode(Mat input, int elementSize, int elementShape){
  Mat outputImage = new Mat();
  Mat element = getKernelFromShape(elementSize, elementShape);
  Imgproc.erode(input,outputImage, element);
  return outputImage;
}

代码示例来源:origin: JavaOpenCVBook/code

public Mat erode(Mat input, int elementSize, int elementShape){
  Mat outputImage = new Mat();
  Mat element = getKernelFromShape(elementSize, elementShape);
  Imgproc.erode(input,outputImage, element);
  return outputImage;
}

代码示例来源:origin: JavaOpenCVBook/code

public Mat erode(Mat input, int elementSize, int elementShape){
  Mat outputImage = new Mat();
  Mat element = getKernelFromShape(elementSize, elementShape);
  Imgproc.erode(input,outputImage, element);
  return outputImage;
}

代码示例来源:origin: us.ihmc/ihmc-perception

public static void morphologicallyOpen(Mat hsvImage, int size)
{
 Imgproc.erode(hsvImage, hsvImage, Imgproc.getStructuringElement(Imgproc.MORPH_ELLIPSE, new Size(size, size)));
 Imgproc.dilate(hsvImage, hsvImage, Imgproc.getStructuringElement(Imgproc.MORPH_ELLIPSE, new Size(size, size)));
}

代码示例来源:origin: us.ihmc/IHMCPerception

public static void morphologicallyClose(Mat hsvImage, int size)
{
 Imgproc.dilate(hsvImage, hsvImage, Imgproc.getStructuringElement(Imgproc.MORPH_ELLIPSE, new Size(size, size)));
 Imgproc.erode(hsvImage, hsvImage, Imgproc.getStructuringElement(Imgproc.MORPH_ELLIPSE, new Size(size, size)));
}

代码示例来源:origin: us.ihmc/IHMCPerception

public static void morphologicallyOpen(Mat hsvImage, int size)
{
 Imgproc.erode(hsvImage, hsvImage, Imgproc.getStructuringElement(Imgproc.MORPH_ELLIPSE, new Size(size, size)));
 Imgproc.dilate(hsvImage, hsvImage, Imgproc.getStructuringElement(Imgproc.MORPH_ELLIPSE, new Size(size, size)));
}

代码示例来源:origin: us.ihmc/ihmc-perception

public static void morphologicallyClose(Mat hsvImage, int size)
{
 Imgproc.dilate(hsvImage, hsvImage, Imgproc.getStructuringElement(Imgproc.MORPH_ELLIPSE, new Size(size, size)));
 Imgproc.erode(hsvImage, hsvImage, Imgproc.getStructuringElement(Imgproc.MORPH_ELLIPSE, new Size(size, size)));
}

代码示例来源:origin: us.ihmc/IHMCPerception

Imgproc.erode(mat, mat, Imgproc.getStructuringElement(Imgproc.MORPH_ELLIPSE, new Size(20, 20)));
Imgproc.dilate(mat, mat, Imgproc.getStructuringElement(Imgproc.MORPH_ELLIPSE, new Size(20, 20)));
Imgproc.erode(mat, mat, Imgproc.getStructuringElement(Imgproc.MORPH_ELLIPSE, new Size(20, 20)));

代码示例来源:origin: us.ihmc/ihmc-perception

Imgproc.erode(mat, mat, Imgproc.getStructuringElement(Imgproc.MORPH_ELLIPSE, new Size(20, 20)));
Imgproc.dilate(mat, mat, Imgproc.getStructuringElement(Imgproc.MORPH_ELLIPSE, new Size(20, 20)));
Imgproc.erode(mat, mat, Imgproc.getStructuringElement(Imgproc.MORPH_ELLIPSE, new Size(20, 20)));

相关文章

微信公众号

最新文章

更多

Imgproc类方法