public abstract static class SCameraPanoramaProcessor.EventCallback extends Object
Constructor and Description |
---|
EventCallback() |
Modifier and Type | Method and Description |
---|---|
abstract void |
onDirectionChanged(int direction)
Called when the direction hint is given from the framework library.
|
abstract void |
onError(int code)
Called to notify the error to application.
|
abstract void |
onLivePreviewDataStitched(Bitmap data)
Called to send the live stitching preview data.
|
abstract void |
onMaxFramesCaptured()
Called when every(Maximum) frame required for Panorama are captured and framework will start final stitching process.
|
void |
onMovingTooFast()
Called to notify application to display help information to move device slowly.
|
abstract void |
onProcessCompleted(Image result)
Called to deliver stitched final result.
|
abstract void |
onRectChanged(int x,
int y)
Called when the panorama capturing rectangle gets changed.
|
abstract void |
onStitchingProgressed(int progress)
Called to notify the progress of stitching the panorama
to the application after completing capture.
|
public abstract void onError(int code)
code
- Error Code.SCameraProcessor.NATIVE_PROCESSOR_MSG_UNKNOWN_ERROR
,
SCameraProcessor.NATIVE_PROCESSOR_MSG_DECODING_FAIL
,
SCameraProcessor.NATIVE_PROCESSOR_MSG_ENCODING_FAIL
,
SCameraProcessor.NATIVE_PROCESSOR_MSG_PROCESSING_FAIL
,
SCameraPanoramaProcessor.NATIVE_PROCESSOR_MSG_PANORAMA_ERROR_NO_DIRECTION
,
SCameraPanoramaProcessor.NATIVE_PROCESSOR_MSG_PANORAMA_ERROR_TRACING
,
SCameraPanoramaProcessor.NATIVE_PROCESSOR_MSG_PANORAMA_ERROR_MAX_FRAME_COUNT
public abstract void onRectChanged(int x, int y)
x
- Left of rectangle(range from -1000 to 1000).y
- Top of rectangle(range from -1000 to 1000).public abstract void onDirectionChanged(int direction)
Direction are specified as one of below.
direction
- Direction of Panorama stitching progress.public abstract void onStitchingProgressed(int progress)
progress
- Progress information(range from 0 to 100).public abstract void onLivePreviewDataStitched(Bitmap data)
First preview size is decided by SCameraProcessor.STREAM_SIZE
and according to following conditions
Max preview size can grow depends on first preview size(scaled SCameraProcessor.STREAM_SIZE
) and camera view angle.
This is flexible value approximated to the first preview size * 360 / camera view angle. You can just assume the size before taking the picture.
For example, If panorama direction is SCameraPanoramaProcessor.PANORAMA_DIRECTION_RIGHT
and camera sensor orientation is 0,
then you can assume max preview width to first preview width * 360 / camera horizontal view angle.
If you want to get camera view angle, refer to following code.
public static int[] getSensorViewAngle(SizeF sensorSize, Size streamSize, float focalLength) { float sensorRatio = sensorSize.getWidth() / sensorSize.getHeight(); float streamRatio = (float)streamSize.getWidth() / streamSize.getHeight(); float sensorWidth = sensorSize.getWidth(); float sensorHeight = sensorSize.getHeight(); if(sensorRatio > streamRatio) { sensorWidth = sensorWidth * (streamRatio / sensorRatio); } else if(sensorRatio < streamRatio) { sensorHeight = sensorHeight * ((1/streamRatio) / (1/sensorRatio)); } int[] viewAngle = new int[2]; viewAngle[0] = (int)(Math.atan(sensorWidth / focalLength / 2) * 2 * 180 / Math.PI); // horizontal view angle viewAngle[1] = (int)(Math.atan(sensorHeight / focalLength / 2) * 2 * 180 / Math.PI); // vertical view angle return viewAngle; }
data
- Live stitching preview Data.public abstract void onMaxFramesCaptured()
Processor will be stopped itself and do final stitching process.
public void onMovingTooFast()
public abstract void onProcessCompleted(Image result)
After this is called, SCameraPanoramaProcessor.stop() or SCameraPanoramaProcessor.cancel() should not be called and Processor could be started again.
Max image size can grow depends on SCameraProcessor.STREAM_SIZE
and camera view angle.
This is flexible value approximate to SCameraProcessor.STREAM_SIZE
* 360 / camera view angle.
You can just assume size before taking picture. For example, If panorama direction is SCameraPanoramaProcessor.PANORAMA_DIRECTION_UP
and sensor orientation is 0, then you can assume max result image height to stream height * 360 / camera vertical view angle.
result
- a Image object holds result image.Copyright © Samsung Electronics, Co., Ltd. All rights reserved.