From cf1055e776639442376477ddc3d733e4e0066f74 Mon Sep 17 00:00:00 2001 From: Mattia Iavarone Date: Sun, 15 Dec 2019 20:36:38 +0100 Subject: [PATCH] Add setFrameProcessingMaxWidth and setFrameProcessingMaxHeight (docs) --- README.md | 2 ++ docs/_posts/2018-12-20-frame-processing.md | 25 ++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/README.md b/README.md index 3982db71..d02ee871 100644 --- a/README.md +++ b/README.md @@ -114,6 +114,8 @@ Using CameraView is extremely simple: app:cameraVideoSizeAspectRatio="@string/video_ratio" app:cameraSnapshotMaxWidth="@integer/snapshot_max_width" app:cameraSnapshotMaxHeight="@integer/snapshot_max_height" + app:cameraFrameProcessingMaxWidth="@integer/processing_max_width" + app:cameraFrameProcessingMaxHeight="@integer/processing_max_height" app:cameraVideoBitRate="@integer/video_bit_rate" app:cameraAudioBitRate="@integer/audio_bit_rate" app:cameraGestureTap="none|autoFocus|takePicture" diff --git a/docs/_posts/2018-12-20-frame-processing.md b/docs/_posts/2018-12-20-frame-processing.md index 87d5714d..e79445c4 100644 --- a/docs/_posts/2018-12-20-frame-processing.md +++ b/docs/_posts/2018-12-20-frame-processing.md @@ -78,12 +78,37 @@ public void process(@NonNull Frame frame) { latch.await(); } ``` + +### Frame Size +The Camera2 engine offers the option to set size constraints for the incoming frames. + +```java +cameraView.setFrameProcessingMaxWidth(maxWidth); +cameraView.setFrameProcessingMaxHeight(maxWidth); +``` + +With other engines, these API have no effect. + +### XML Attributes + +```xml + +``` + ### Related APIs |Frame API|Type|Description| |---------|----|-----------| |`camera.addFrameProcessor(FrameProcessor)`|`-`|Register a `FrameProcessor`.| +|`camera.removeFrameProcessor(FrameProcessor)`|`-`|Removes a `FrameProcessor`.| +|`camera.clearFrameProcessors()`|`-`|Removes all `FrameProcessor`s.| +|`camera.setFrameProcessingMaxWidth(int)`|`-`|Sets the max width for incoming frames.| +|`camera.setFrameProcessingMaxHeight(int)`|`-`|Sets the max height for incoming frames.| +|`camera.getFrameProcessingMaxWidth()`|`int`|Gets the max width for incoming frames.| +|`camera.getFrameProcessingMaxHeight()`|`int`|Gets the max height for incoming frames.| |`frame.getData()`|`byte[]`|The current preview frame, in its original orientation.| |`frame.getTime()`|`long`|The preview timestamp, in `System.currentTimeMillis()` reference.| |`frame.getRotation()`|`int`|The rotation that should be applied to the byte array in order to see what the user sees.|