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


Java 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个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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,代码行数:41,代码来源: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,代码行数:42,代码来源: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,代码行数:42,代码来源:CameraServer.java


注:本文中的com.ni.vision.NIVision.RawData.getBuffer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。