[英]Get default camera preview frames
I have this code to open fefault camera 我有这段代码可以打开fefault相机
Intent camera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(camera, CAMERA_REQUEST);
And this for capture the foto 而这是为了捕捉照片
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Bitmap bitmap = (Bitmap) Objects.requireNonNull(data.getExtras()).get("data");
ByteArrayOutputStream stream=new ByteArrayOutputStream();
assert bitmap != null;
bitmap.compress(Bitmap.CompressFormat.PNG,100,stream);
byte[] imageBytes=stream.toByteArray();
sendReceive.write(String.valueOf(imageBytes.length).getBytes());
int subArraySize=400;
for(int i=0;i<imageBytes.length;i+=subArraySize){
byte[] tempArray;
tempArray= Arrays.copyOfRange(imageBytes,i,Math.min(imageBytes.length,i+subArraySize));
sendReceive.write(tempArray);
}
}
I have a question how i can capture the camera preview frames? 我有一个问题,如何捕捉相机预览框?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.