当前位置: 首页>>代码示例>>Java>>正文


Java方法com.ni.vision.NIVision.RawData.getBuffer代码示例

以下是Java方法com.ni.vision.NIVision.RawData.getBuffer的代码示例。如果您正苦于以下问题:Java RawData.getBuffer方法的具体用法?Java RawData.getBuffer怎么用?Java RawData.getBuffer使用的例子?那么恭喜您, 这里整理的方法代码示例例程将为您提供帮助。您也可以进一步了解该方法所在com.ni.vision.NIVision.RawData的用法示例。

本文一共展示了RawData.getBuffer的3个开源代码实例,这些例子默认根据受欢迎程度排序。您可以为喜欢的代码打CALL点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setImage

import com.ni.vision.NIVision.RawData; //导入方法依赖的package包/类
/**
 * Manually change the image that is served by the MJPEG stream. This can be
 * called to pass custom annotated images to the dashboard. Note that, for
 * 640x480 video, this method could take between 40 and 50 milliseconds to
 * complete.
 *
 * This shouldn't be called if {@link #startAutomaticCapture} is called.
 *
 * @param image The IMAQ image to show on the dashboard
 */
public void setImage(Image image) {
  // handle multi-threadedness

  /* Flatten the IMAQ image to a JPEG */
  RawData data =
      NIVision.imaqFlatten(image, NIVision.FlattenType.FLATTEN_IMAGE,
          NIVision.CompressionType.COMPRESSION_JPEG, 10 * m_quality);
  ByteBuffer buffer = data.getBuffer();
  boolean hwClient;

  synchronized (this) {
    hwClient = m_hwClient;
  }

  /* Find the start of the JPEG data */
  int index = 0;
  if (hwClient) {
    while (index < buffer.limit() - 1) {
      if ((buffer.get(index) & 0xff) == 0xFF && (buffer.get(index + 1) & 0xff) == 0xD8)
        break;
      index++;
    }
  }

  if (buffer.limit() - index - 1 <= 2) {
    throw new VisionException("data size of flattened image is less than 2. Try another camera! ");
  }

  setImageData(data, index);
}
 
开发者ID:FRC2832,项目:Robot_2016,完整代码来源:CameraServer2832.java


示例2: setImage

import com.ni.vision.NIVision.RawData; //导入方法依赖的package包/类
/**
 * Manually change the image that is served by the MJPEG stream. This can be
 * called to pass custom annotated images to the dashboard. Note that, for
 * 640x480 video, this method could take between 40 and 50 milliseconds to
 * complete.
 *
 * 
 *
 * @param image The IMAQ image to show on the dashboard
 */
public void setImage(Image image) {
  // handle multi-threadedness

  /* Flatten the IMAQ image to a JPEG */

  RawData data =
      NIVision.imaqFlatten(image, NIVision.FlattenType.FLATTEN_IMAGE,
          NIVision.CompressionType.COMPRESSION_JPEG, 10 * m_quality);
  ByteBuffer buffer = data.getBuffer();
  boolean hwClient;

  synchronized (this) {
    hwClient = m_hwClient;
  }

  /* Find the start of the JPEG data */
  int index = 0;
  if (hwClient) {
    while (index < buffer.limit() - 1) {
      if ((buffer.get(index) & 0xff) == 0xFF && (buffer.get(index + 1) & 0xff) == 0xD8)
        break;
      index++;
    }
  }

  if (buffer.limit() - index - 1 <= 2) {
    throw new VisionException("data size of flattened image is less than 2. Try another camera! ");
  }

  setImageData(data, index);
}
 
开发者ID:MontclairRobotics,项目:Sprocket,完整代码来源:CameraServers.java


示例3: setImage

import com.ni.vision.NIVision.RawData; //导入方法依赖的package包/类
/**
 * Manually change the image that is served by the MJPEG stream. This can be
 * called to pass custom annotated images to the dashboard. Note that, for
 * 640x480 video, this method could take between 40 and 50 milliseconds to
 * complete.
 *
 * This shouldn't be called if {@link #startAutomaticCapture} is called.
 *
 * @param image The IMAQ image to show on the dashboard
 */
public void setImage(Image image) {
  // handle multi-threadedness

  /* Flatten the IMAQ image to a JPEG */

  RawData data =
      NIVision.imaqFlatten(image, NIVision.FlattenType.FLATTEN_IMAGE,
          NIVision.CompressionType.COMPRESSION_JPEG, 10 * m_quality);
  ByteBuffer buffer = data.getBuffer();
  boolean hwClient;

  synchronized (this) {
    hwClient = m_hwClient;
  }

  /* Find the start of the JPEG data */
  int index = 0;
  if (hwClient) {
    while (index < buffer.limit() - 1) {
      if ((buffer.get(index) & 0xff) == 0xFF && (buffer.get(index + 1) & 0xff) == 0xD8)
        break;
      index++;
    }
  }

  if (buffer.limit() - index - 1 <= 2) {
    throw new VisionException("data size of flattened image is less than 2. Try another camera! ");
  }

  setImageData(data, index);
}
 
开发者ID:trc492,项目:Frc2016FirstStronghold,完整代码来源:CameraServer.java



注:本文示例均筛选自Github平台上各路大神开发的开源项目,代码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。