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


Java ImageFormat.YV12属性代码示例

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


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

示例1: rgba

@Override
public Mat rgba() {
    if (mPreviewFormat == ImageFormat.NV21)
        Imgproc.cvtColor(mYuvFrameData, mRgba, Imgproc.COLOR_YUV2RGBA_NV21, 4);
    else if (mPreviewFormat == ImageFormat.YV12)
        Imgproc.cvtColor(mYuvFrameData, mRgba, Imgproc.COLOR_YUV2RGB_I420, 4);  // COLOR_YUV2RGBA_YV12 produces inverted colors
    else
        throw new IllegalArgumentException("Preview Format can be NV21 or YV12");

    return mRgba;
}
 
开发者ID:typer9527,项目名称:FaceDetectDemo,代码行数:11,代码来源:JavaCameraView.java

示例2: renderHevcImageWithFormat

private static Bitmap renderHevcImageWithFormat(ByteBuffer bitstream, ImageInfo info, int imageFormat) throws FormatFallbackException {
    try (ImageReader reader = ImageReader.newInstance(info.size.getWidth(), info.size.getHeight(), imageFormat, 1)) {
        renderHevcImage(bitstream, info, reader.getSurface());
        Image image = null;
        try {
            try {
                image = reader.acquireNextImage();
            } catch (UnsupportedOperationException ex) {
                throw new FormatFallbackException(ex);
            }

            switch (image.getFormat()) {
                case ImageFormat.YUV_420_888:
                case ImageFormat.YV12:
                    return convertYuv420ToBitmap(image);
                case ImageFormat.RGB_565:
                    return convertRgb565ToBitmap(image);
                default:
                    throw new RuntimeException("unsupported image format(" + image.getFormat() + ")");
            }
        } finally {
            if (image != null) {
                image.close();
            }
        }
    }
}
 
开发者ID:yohhoy,项目名称:heifreader,代码行数:27,代码来源:HeifReader.java

示例3: createYuvType

@RequiresApi(18)
public static Type createYuvType(RenderScript rs, int x, int y, int yuvFormat) {
    boolean supported = yuvFormat == ImageFormat.NV21 || yuvFormat == ImageFormat.YV12;
    if (Build.VERSION.SDK_INT >= 19) {
        supported |= yuvFormat == ImageFormat.YUV_420_888;
    }
    if (!supported) {
        throw new IllegalArgumentException("invalid yuv format: " + yuvFormat);
    }
    return new Type.Builder(rs, createYuvElement(rs)).setX(x).setY(y).setYuvFormat(yuvFormat)
            .create();
}
 
开发者ID:lydia-schiff,项目名称:hella-renderscript,代码行数:12,代码来源:RsUtil.java

示例4: onPreviewFrame

@Override
public void onPreviewFrame(byte[] data, Camera camera) {
  //convert yv12 to nv21
  if (imageFormat == ImageFormat.YV12) {
    data = YUVUtil.YV12toNV21(data, width, height);
  }
  //Only if front camera and portrait or reverse portrait
  if (isFrontCamera && (orientation == 90 || orientation == 270)) {
    data = YUVUtil.rotateNV21(data, width, height, 180);
  }
  getCameraData.inputYUVData(data);
  camera.addCallbackBuffer(yuvBuffer);
}
 
开发者ID:pedroSG94,项目名称:rtmp-rtsp-stream-client-java,代码行数:13,代码来源:Camera1ApiManager.java

示例5: SrsEncoder

public SrsEncoder(SrsFlvMuxer flvMuxer, SrsMp4Muxer mp4Muxer) {
    this.flvMuxer = flvMuxer;
    this.mp4Muxer = mp4Muxer;

    mVideoColorFormat = chooseVideoEncoder();
    if (mVideoColorFormat == MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV420Planar) {
        VFORMAT = ImageFormat.YV12;
    } else if (mVideoColorFormat == MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV420SemiPlanar) {
        VFORMAT = ImageFormat.NV21;
    } else {
        throw new IllegalStateException("Unsupported color format!");
    }
}
 
开发者ID:lisnstatic,项目名称:live_master,代码行数:13,代码来源:SrsEncoder.java


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