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

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

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

Imgproc.Laplacian介绍

[英]Calculates the Laplacian of an image.

The function calculates the Laplacian of the source image by adding up the second x and y derivatives calculated using the Sobel operator:

dst = Delta src = (d^2 src)/(dx^2) + (d^2 src)/(dy^2)

This is done when ksize > 1. When ksize == 1, the Laplacian is computed by filtering the image with the following 3 x 3 aperture:

vecthreethree 0101(-4)1010

Note:

  • An example using the Laplace transformation for edge detection can be found at opencv_source_code/samples/cpp/laplace.cpp
    [中]计算图像的拉普拉斯函数。
    该函数通过将使用Sobel运算符计算的第二个x和y导数相加来计算源图像的拉普拉斯函数:
    dst=δsrc=(d^2 src)/(dx^2)+(d^2 src)/(dy^2)
    这是在ksize > 1时完成的。当ksize == 1时,通过使用以下3 x 3孔径过滤图像来计算拉普拉斯算子:
    VECThreethree0101(-4)1010
    注:
    *在opencv_source_code/samples/cpp/Laplace中可以找到使用拉普拉斯变换进行边缘检测的示例。cpp

代码示例

代码示例来源:origin: openpnp/openpnp

@Override
  public Result process(CvPipeline pipeline) throws Exception {
    Mat mat = pipeline.getWorkingImage();
  Imgproc.Laplacian(mat, mat, mat.depth());
    return null;
  }
}

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

protected void processOperation() {

    if(sobelString.equals(operation)){
      Imgproc.Sobel(originalImage, image, -1, xOrder,yOrder,aperture,1.0, 0.0);
//            Core.convertScaleAbs(image, image);
    }
    else if(laplaceString.equals(operation)){
      Imgproc.Laplacian(originalImage, image, -1, aperture, 1.0, 0.0);
//            Core.convertScaleAbs(image, image);
//            Imgproc.threshold(image, image, 1, 255, Imgproc.THRESH_BINARY_INV);
      
    }
    else if(cannyString.equals(operation)){
      Imgproc.Canny(originalImage, image, lowThreshold, highThreshold, aperture, false);
    }
    else if(noneString.equals(operation)){
      image = originalImage.clone();
    }

    updateView(image);
  }

相关文章

Imgproc类方法