gpt4 book ai didi

com.twelvemonkeys.imageio.color.YCbCrConverter类的使用及代码示例

转载 作者:知者 更新时间:2024-03-14 05:10:49 28 4
gpt4 key购买 nike

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

YCbCrConverter介绍

[英]Fast YCbCr to RGB conversion.
[中]快速YCbCr到RGB转换。

代码示例

代码示例来源:origin: haraldk/TwelveMonkeys

private static void convertYCbCr2RGB(final Raster raster, final int numComponents) {
  final int height = raster.getHeight();
  final int width = raster.getWidth();
  final byte[] data = ((DataBufferByte) raster.getDataBuffer()).getData();
  for (int y = 0; y < height; y++) {
    for (int x = 0; x < width; x++) {
      YCbCrConverter.convertYCbCr2RGB(data, data, (x + y * width) * numComponents);
    }
  }
}

代码示例来源:origin: haraldk/TwelveMonkeys

public static void convertYCbCr2RGB(final byte[] yCbCr, final byte[] rgb, final int offset) {
  int y = yCbCr[offset] & 0xff;
  int cr = yCbCr[offset + 2] & 0xff;
  int cb = yCbCr[offset + 1] & 0xff;
  rgb[offset] = clamp(y + Cr_R_LUT[cr]);
  rgb[offset + 1] = clamp(y + (Cb_G_LUT[cb] + Cr_G_LUT[cr] >> SCALEBITS));
  rgb[offset + 2] = clamp(y + Cb_B_LUT[cb]);
}

代码示例来源:origin: haraldk/TwelveMonkeys

private static void convertYCCK2CMYK(final Raster raster) {
  final int height = raster.getHeight();
  final int width = raster.getWidth();
  final byte[] data = ((DataBufferByte) raster.getDataBuffer()).getData();
  for (int y = 0; y < height; y++) {
    for (int x = 0; x < width; x++) {
      int offset = (x + y * width) * 4;
      // YCC -> CMY
      YCbCrConverter.convertYCbCr2RGB(data, data, offset);
      // Inverse K
      data[offset + 3] = (byte) (0xff - data[offset + 3] & 0xff);
    }
  }
}

代码示例来源:origin: haraldk/TwelveMonkeys

public static void convertYCbCr2RGB(final byte[] yCbCr, final byte[] rgb, final double[] coefficients, double[] referenceBW, final int offset) {
  double y;
  double cb;
  double cr;
  if (referenceBW == null) {
    // Default case
    y = (yCbCr[offset] & 0xff);
    cb = (yCbCr[offset + 1] & 0xff) - 128;
    cr = (yCbCr[offset + 2] & 0xff) - 128;
  }
  else {
    // Custom values
    y = ((yCbCr[offset] & 0xff) - referenceBW[0]) * 255.0 / (referenceBW[1] - referenceBW[0]);
    cb = ((yCbCr[offset + 1] & 0xff) - referenceBW[2]) * 127.0 / (referenceBW[3] - referenceBW[2]);
    cr = ((yCbCr[offset + 2] & 0xff) - referenceBW[4]) * 127.0 / (referenceBW[5] - referenceBW[4]);
  }
  double lumaRed = coefficients[0];
  double lumaGreen = coefficients[1];
  double lumaBlue = coefficients[2];
  int red = (int) Math.round(cr * (2.0 - 2.0 * lumaRed) + y);
  int blue = (int) Math.round(cb * (2.0 - 2.0 * lumaBlue) + y);
  int green = (int) Math.round((y - lumaRed * red - lumaBlue * blue) / lumaGreen);
  rgb[offset] = clamp(red);
  rgb[offset + 2] = clamp(blue);
  rgb[offset + 1] = clamp(green);
}

代码示例来源:origin: haraldk/TwelveMonkeys

YCbCrConverter.convertYCbCr2RGB(data, data, i);
YCbCrConverter.convertYCbCr2RGB(data, data, coefficients, referenceBW, i);

代码示例来源:origin: com.github.lafa.twelvemonkeyspurejava.imageio/imageio-core

public static void convertYCbCr2RGB(final byte[] yCbCr, final byte[] rgb, final int offset) {
  int y = yCbCr[offset] & 0xff;
  int cr = yCbCr[offset + 2] & 0xff;
  int cb = yCbCr[offset + 1] & 0xff;
  rgb[offset] = clamp(y + Cr_R_LUT[cr]);
  rgb[offset + 1] = clamp(y + (Cb_G_LUT[cb] + Cr_G_LUT[cr] >> SCALEBITS));
  rgb[offset + 2] = clamp(y + Cb_B_LUT[cb]);
}

代码示例来源:origin: haraldk/TwelveMonkeys

YCbCrConverter.convertYCbCr2RGB(thumbData, thumbData, i);

代码示例来源:origin: com.github.lafa.twelvemonkeyspurejava.imageio/imageio-core

public static void convertYCbCr2RGB(final byte[] yCbCr, final byte[] rgb, final double[] coefficients, double[] referenceBW, final int offset) {
  double y;
  double cb;
  double cr;
  if (referenceBW == null) {
    // Default case
    y = (yCbCr[offset] & 0xff);
    cb = (yCbCr[offset + 1] & 0xff) - 128;
    cr = (yCbCr[offset + 2] & 0xff) - 128;
  }
  else {
    // Custom values
    y = ((yCbCr[offset] & 0xff) - referenceBW[0]) * 255.0 / (referenceBW[1] - referenceBW[0]);
    cb = ((yCbCr[offset + 1] & 0xff) - referenceBW[2]) * 127.0 / (referenceBW[3] - referenceBW[2]);
    cr = ((yCbCr[offset + 2] & 0xff) - referenceBW[4]) * 127.0 / (referenceBW[5] - referenceBW[4]);
  }
  double lumaRed = coefficients[0];
  double lumaGreen = coefficients[1];
  double lumaBlue = coefficients[2];
  int red = (int) Math.round(cr * (2.0 - 2.0 * lumaRed) + y);
  int blue = (int) Math.round(cb * (2.0 - 2.0 * lumaBlue) + y);
  int green = (int) Math.round((y - lumaRed * red - lumaBlue * blue) / lumaGreen);
  rgb[offset] = clamp(red);
  rgb[offset + 2] = clamp(blue);
  rgb[offset + 1] = clamp(green);
}

代码示例来源:origin: com.twelvemonkeys.imageio/imageio-jpeg

private static void convertYCbCr2RGB(final Raster raster, final int numComponents) {
  final int height = raster.getHeight();
  final int width = raster.getWidth();
  final byte[] data = ((DataBufferByte) raster.getDataBuffer()).getData();
  for (int y = 0; y < height; y++) {
    for (int x = 0; x < width; x++) {
      YCbCrConverter.convertYCbCr2RGB(data, data, (x + y * width) * numComponents);
    }
  }
}

代码示例来源:origin: com.twelvemonkeys.imageio/imageio-jpeg

private static void convertYCCK2CMYK(final Raster raster) {
  final int height = raster.getHeight();
  final int width = raster.getWidth();
  final byte[] data = ((DataBufferByte) raster.getDataBuffer()).getData();
  for (int y = 0; y < height; y++) {
    for (int x = 0; x < width; x++) {
      int offset = (x + y * width) * 4;
      // YCC -> CMY
      YCbCrConverter.convertYCbCr2RGB(data, data, offset);
      // Inverse K
      data[offset + 3] = (byte) (0xff - data[offset + 3] & 0xff);
    }
  }
}

代码示例来源:origin: com.github.lafa.twelvemonkeyspurejava.imageio/imageio-tiff

YCbCrConverter.convertYCbCr2RGB(data, data, i);
YCbCrConverter.convertYCbCr2RGB(data, data, coefficients, referenceBW, i);

代码示例来源:origin: com.twelvemonkeys.imageio/imageio-jpeg

YCbCrConverter.convertYCbCr2RGB(thumbData, thumbData, i);

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com