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


Java NIVision.imaqFlatten方法代码示例

本文整理汇总了Java中com.ni.vision.NIVision.imaqFlatten方法的典型用法代码示例。如果您正苦于以下问题:Java NIVision.imaqFlatten方法的具体用法?Java NIVision.imaqFlatten怎么用?Java NIVision.imaqFlatten使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.ni.vision.NIVision的用法示例。


在下文中一共展示了NIVision.imaqFlatten方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setImageData

import com.ni.vision.NIVision; //导入方法依赖的package包/类
private synchronized void setImageData(RawData data, int start) {
//flip it here, since it is called by setImage anyways
if(flipped){
	//make an image out of data
	Image image = null;
	NIVision.imaqUnflatten(image, data, data.getBuffer().array().length);
	//flip it
	Image flippedImage = null;
	NIVision.imaqFlip(flippedImage, image, FlipAxis.HORIZONTAL_AXIS);
	//change data to the data of the flipped image
	data = NIVision.imaqFlatten(flippedImage, NIVision.FlattenType.FLATTEN_IMAGE,
            NIVision.CompressionType.COMPRESSION_JPEG, 10 * m_quality);
}
if (m_imageData != null && m_imageData.data != null) {
     m_imageData.data.free();
     if (m_imageData.data.getBuffer() != null){
       m_imageDataPool.addLast(m_imageData.data.getBuffer());
     }
     m_imageData = null;
   }
   m_imageData = new CameraData(data, start);
   notifyAll();
 }
 
开发者ID:FRC2832,项目名称:Robot_2016,代码行数:24,代码来源:CameraServer2832.java

示例2: setImage

import com.ni.vision.NIVision; //导入方法依赖的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

示例3: setImage

import com.ni.vision.NIVision; //导入方法依赖的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

示例4: setImage

import com.ni.vision.NIVision; //导入方法依赖的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.imaqFlatten方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。