admin管理员组

文章数量:1658595

描述:之所以我把它翻译成最值滤波器,因为它的原理就是在卷积核区域内,中心点的值如果大于或小于附近值的最大值或最小值时,将大于最大值的赋值为最大值,将小于最小值的赋值为最小值,这就是Conservative Smoothing Filter


如下图所示:




这上面的图表明中间点150要换成127,简单点讲就是大于最大值的等于最大值,小于最小值的等于最小值,在最小值和最大值之间的值不变。


Code:

  /**
   * Finds the maximum value from a 3x3 pixel neighbourhood overlaid with
   * a 3x3 kernel (on/off). The centre pixel of the kernel is ignored.
   *
   * @param input The 2D array of pixel values representing the image.
   * @param kernel The array representing the kernel.
   * @param w The width of the image.
   * @param h The height of the image.
   * @param x The x coordinate of the centre of the 3x3 neighbourhood.
   * @param y The y coordinate of the centre of the 3x3 neighbourhood.
   * @return The maximum value.
   */
  public static int maxNeighbour(int [][] input, int [] kernel,
			  int w, int h, int x, int y) {

    int [] neighbour = new int [9];
    boolean [] neighbourPresent = new boolean [9];
    int max;
    for(int j=0;j&l

本文标签: 滤波器图像处理ConservativeSmoothingFilter