标签:des blog http io os ar java for sp
============问题描述============
protected void initCamre() { camera = Camera.open(0); camera.setDisplayOrientation(90); Camera.Parameters parameters = camera.getParameters(); parameters.setPreviewSize(720, 1280); parameters.setPreviewFpsRange(4, 10); parameters.setPictureFormat(ImageFormat.JPEG); parameters.set("jpeg-quelity", 85); parameters.setPictureSize(720, 1280); if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE)) { parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE); } int[] textures = new int[1]; GLES20.glGenTextures(1, textures, 0); SurfaceTexture surfaceTexture = new SurfaceTexture(textures[0]); try { camera.setPreviewTexture(surfaceTexture); camera.setPreviewCallback(new MyCamera()); camera.startPreview(); } catch (IOException e) { Log.i("tyty", e.toString()); e.printStackTrace(); } }
class MyCamera implements PreviewCallback { @Override public void onPreviewFrame(byte[] data, Camera camera) { Camera.Parameters ps = camera.getParameters(); int[] imgs = new int[ps.getPreviewSize().width * ps.getPreviewSize().height]; camera.addCallbackBuffer(data); Log.i("tyty", "回调"); } }
============解决方案1============
============解决方案2============
困扰一天啦,求大神不吝指导,Camera的onPreviewFrame中的问题
标签:des blog http io os ar java for sp
原文地址:http://www.cnblogs.com/lmyangbk/p/4041911.html