gpt4 book ai didi

us.ihmc.codecs.yuv.YUVPictureConverter类的使用及代码示例

转载 作者:知者 更新时间:2024-03-15 05:32:49 30 4
gpt4 key购买 nike

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

YUVPictureConverter介绍

暂无

代码示例

代码示例来源:origin: us.ihmc/IHMCVideoCodecs

/**
* Convert YUVPicture to BufferedImage, minimizing object allocation
* 
* @param picture YUVPicture to convert
* @return new BufferedImage.
*/
public BufferedImage toBufferedImage(YUVPicture picture)
{
 return toBufferedImage(picture, null);
}

代码示例来源:origin: us.ihmc/IHMCVideoCodecs

@Override
public void encodeFrame(BufferedImage frame) throws IOException
{
 if(converter == null)
 {
   converter = new YUVPictureConverter();
 }
 YUVPicture pic = converter.fromBufferedImage(frame, YUVSubsamplingType.YUV420);
 encodeFrame(pic);
 pic.delete();
}

代码示例来源:origin: us.ihmc/ihmc-video-codecs

YUVPictureConverter converter = new YUVPictureConverter();
  final BufferedImage img = converter.toBufferedImage(picture);
  SwingUtilities.invokeLater(new Runnable()

代码示例来源:origin: us.ihmc/IHMCCommunication

public byte[] convertBufferedImageToJPEGData(BufferedImage bufferedImage)
  {
   try
   {
     YUVPicture picture = converter.fromBufferedImage(bufferedImage, YUVSubsamplingType.YUV420);
     ByteBuffer buffer = encoder.encode(picture, 75);
     byte[] data = new byte[buffer.remaining()];
     buffer.get(data);
     return data;
   }
   catch (IOException e)
   {
     e.printStackTrace();
     return null;
   }
  }
}

代码示例来源:origin: us.ihmc/IHMCVideoCodecs

YUVPictureConverter converter = new YUVPictureConverter();
  final BufferedImage img = converter.toBufferedImage(picture);
  SwingUtilities.invokeLater(new Runnable()

代码示例来源:origin: us.ihmc/IHMCVideoCodecs

@Override
public void encodeFrame(BufferedImage frame) throws IOException
{
 YUVPicture picture = converter.fromBufferedImage(frame, YUVSubsamplingType.YUV420);
 encodeFrame(picture);
 picture.delete();
}

代码示例来源:origin: us.ihmc/ihmc-video-codecs

/**
* Convert YUVPicture to BufferedImage, minimizing object allocation
* 
* @param picture YUVPicture to convert
* @return new BufferedImage.
*/
public BufferedImage toBufferedImage(YUVPicture picture)
{
 return toBufferedImage(picture, null);
}

代码示例来源:origin: us.ihmc/ihmc-video-codecs

@Override
public void encodeFrame(BufferedImage frame) throws IOException
{
 if(converter == null)
 {
   converter = new YUVPictureConverter();
 }
 YUVPicture pic = converter.fromBufferedImage(frame, YUVSubsamplingType.YUV420);
 encodeFrame(pic);
 pic.delete();
}

代码示例来源:origin: us.ihmc/ihmc-video-codecs

@Override
public void encodeFrame(BufferedImage frame) throws IOException
{
 YUVPicture picture = converter.fromBufferedImage(frame, YUVSubsamplingType.YUV420);
 encodeFrame(picture);
 picture.delete();
}

代码示例来源:origin: us.ihmc/ihmc-video-codecs

@Override
 public void run()
 {
   image.setIcon(new ImageIcon(converter.toBufferedImage(img)));
 }
});

代码示例来源:origin: us.ihmc/IHMCCommunication

@Override
public void updateImage(VideoSource videoSource, BufferedImage bufferedImage, long timeStamp, Point3d cameraPosition, Quat4d cameraOrientation, IntrinsicParameters intrinsicParameters)
{
 YUVPicture picture = converter.fromBufferedImage(bufferedImage, YUVSubsamplingType.YUV420);
 try
 {
   ByteBuffer buffer;
   synchronized (hackyLockBecauseJPEGEncoderIsNotThreadsafe)
   {
    buffer = encoder.encode(picture, 75);
   }
   byte[] data =  new byte[buffer.remaining()];
   buffer.get(data);
   handler.newVideoPacketAvailable(videoSource, timeStamp, data, cameraPosition, cameraOrientation, intrinsicParameters);
 }
 catch (IOException e)
 {
   e.printStackTrace();
 }
 picture.delete();
}

代码示例来源:origin: us.ihmc/IHMCVideoCodecs

@Override
 public void run()
 {
   image.setIcon(new ImageIcon(converter.toBufferedImage(img)));
 }
});

代码示例来源:origin: us.ihmc/IHMCCommunication

YUVPicture frame = converter.fromBufferedImage(bufferedImage, YUVSubsamplingType.YUV420);
frame.scale(desiredEvenHorizontalResolution, desiredEvenVerticalResolution, FilterModeEnum.kFilterBilinear);
try

代码示例来源:origin: us.ihmc/ihmc-robot-data-visualizer

@Override
 public void run()
 {
   img = converter.toBufferedImage(nextFrame, img);
   nextFrame.delete();
   ImageIcon icon = new ImageIcon(img);
   label.setIcon(icon);
   if (img.getWidth() != width || img.getHeight() != height)
   {
    width = img.getWidth();
    height = img.getHeight();
    label.setPreferredSize(new Dimension(width, height));
    pack();
   }
 }
});

代码示例来源:origin: us.ihmc/RobotDataCommunication

@Override
 public void run()
 {
   img = converter.toBufferedImage(nextFrame, img);
   nextFrame.delete();
   ImageIcon icon = new ImageIcon(img);
   label.setIcon(icon);
   if (img.getWidth() != width || img.getHeight() != height)
   {
    width = img.getWidth();
    height = img.getHeight();
    label.setPreferredSize(new Dimension(width, height));
    pack();
   }
 }
});

代码示例来源:origin: us.ihmc/IHMCRobotDataVisualizer

@Override
 public void run()
 {
   img = converter.toBufferedImage(nextFrame, img);
   nextFrame.delete();
   ImageIcon icon = new ImageIcon(img);
   label.setIcon(icon);
   if (img.getWidth() != width || img.getHeight() != height)
   {
    width = img.getWidth();
    height = img.getHeight();
    label.setPreferredSize(new Dimension(width, height));
    pack();
   }
 }
});

代码示例来源:origin: us.ihmc/IHMCCommunication

@Override
public synchronized void consumeObject(byte[] data, Point3d position, Quat4d orientation, IntrinsicParameters intrinsicParameters)
{
 nalBuffer.clear();
 nalBuffer.put(data);
 nalBuffer.clear();
 
 YUVPicture frame = decoder.decodeFrame(nalBuffer);
 if(frame != null)
 {
   image = converter.toBufferedImage(frame, image);
   videoStreamer.updateImage(image, position, orientation, intrinsicParameters);
   frame.delete();
 }
 
 
}

代码示例来源:origin: us.ihmc/IHMCCommunication

public BufferedImage decompressJPEGDataToBufferedImage(byte[] jpegData)
  {
   ByteBuffer byteBuffer = byteBufferProvider.getOrCreateBuffer(jpegData.length);
   byteBuffer.put(jpegData);
   byteBuffer.flip();
   YUVPicture yuvPicture = jpegDecoder.decode(byteBuffer);
   BufferedImage bufferedImage = yuvPictureConverter.toBufferedImage(yuvPicture);
   yuvPicture.delete();
   return bufferedImage;
  }
}

代码示例来源:origin: us.ihmc/IHMCCommunication

@Override
  public void consumeObject(byte[] data, Point3d position, Quat4d orientation, IntrinsicParameters intrinsicParameters)
  {
   ByteBuffer buffer = byteBufferProvider.getOrCreateBuffer(data.length);
   buffer.put(data);
   buffer.flip();
   YUVPicture pic = decoder.decode(buffer);
   BufferedImage img = converter.toBufferedImage(pic);
   pic.delete();
   videoStreamer.updateImage(img, position, orientation, intrinsicParameters);
  }
}

代码示例来源:origin: us.ihmc/ImageProcessing

private void streamBufferedImagesFromVideo()
{
 // Now, we start walking through the container looking at each packet.
 YUVPicture leftEye;
 YUVPicture rightEye;
 try
 {
   while ((leftEye = leftEyeDemuxer.getNextFrame()) != null && (rightEye = rightEyeDemuxer.getNextFrame()) != null)
   {
    videoListener.updateImage(converter.toBufferedImage(leftEye), converter.toBufferedImage(rightEye));
    leftEye.delete();
    rightEye.delete();
    //TODO: Insert eait loop
   }
 }
 catch (IOException e)
 {
   e.printStackTrace();
 }
}

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