예제 #1
0
  public static ColoredλImage производная(
      ColoredλImage input_image, Rectangle input_image_dimentions) {
    return (x, y) -> {

      // Модули производных по x и y для красного канала
      double Rx =
          abs(input_image.valueAt(x + 1, y).red() - input_image.valueAt(x - 1, y).red()) / 2;
      double Ry =
          abs(input_image.valueAt(x, y + 1).red() - input_image.valueAt(x, y - 1).red()) / 2;

      // для зелёного
      double Gx =
          abs(input_image.valueAt(x + 1, y).green() - input_image.valueAt(x - 1, y).green()) / 2;
      double Gy =
          abs(input_image.valueAt(x, y + 1).green() - input_image.valueAt(x, y - 1).green()) / 2;

      // и для синего
      double Bx =
          abs(input_image.valueAt(x + 1, y).blue() - input_image.valueAt(x - 1, y).blue()) / 2;
      double By =
          abs(input_image.valueAt(x, y + 1).blue() - input_image.valueAt(x, y - 1).blue()) / 2;

      double R = Rx + Ry;
      double G = Gx + Gy;
      double B = Bx + By;

      return Colors.newColor((float) R, (float) G, (float) B);
    };
  }
예제 #2
0
  private static ColoredλImage bright(ColoredλImage image_1) {
    return (x, y) -> {
      Color pixel = image_1.valueAt(x, y);
      float multiplier = 8;
      double R = pixel.red() * multiplier;
      double G = pixel.green() * multiplier;
      double B = pixel.blue() * multiplier;

      if (R > 1) {
        R = 1;
      }
      if (G > 1) {
        G = 1;
      }
      if (B > 1) {
        B = 1;
      }

      return Colors.newColor((float) R, (float) G, (float) B);
    };
  }