Package com.leia.core
Class SharedCameraSink
- java.lang.Object
-
- com.leia.core.SharedCameraSink
-
public class SharedCameraSink extends Object
SharedCameraSink defines an interface for an external user to notify CNSDK of camera events. This is a mere wrapper around C++ implementation so it should be explicitly released by the owner.
-
-
Constructor Summary
Constructors Constructor Description SharedCameraSink(long coreLib)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Release the instance.void
onImage(Image image, int rotation, boolean isSystemTimestamp)
Notify about a new camera frame.void
onImageJni(ByteBuffer imageBuffer, int pixelStride, int rowStride, int rotation, long timestamp, boolean isSystemTimestamp)
Notify about a new camera frame.void
onLux(float lux)
Notify lux value change.void
updateIntrinsics(int width, int height, float ppx, float ppy, float fx, float fy, float[] distortionCoeffs, boolean isMirrored)
The following intrinsics are using the pinhole camera model.
-
-
-
Method Detail
-
close
public void close()
Release the instance.
-
onLux
public void onLux(float lux)
Notify lux value change.
-
onImage
public void onImage(Image image, int rotation, boolean isSystemTimestamp)
Notify about a new camera frame.- Parameters:
image
- camera frame imagerotation
- camera frame rotationisSystemTimestamp
- whether image's timestamp is in the same timebase asSystemClock.elapsedRealtimeNanos()
- Throws:
RuntimeException
- if format of the image is not one of: Y8, YUV_420_888, YUV_422_888, YUV_444_888.- See Also:
CameraCharacteristics.SENSOR_INFO_TIMESTAMP_SOURCE
-
onImageJni
public void onImageJni(ByteBuffer imageBuffer, int pixelStride, int rowStride, int rotation, long timestamp, boolean isSystemTimestamp)
Notify about a new camera frame.- Parameters:
imageBuffer
- Y (luma) imagepixelStride
- distance between adjacent pixel samples, in bytesrowStride
- row stride for imageBuffer, in bytesrotation
- camera frame rotationtimestamp
- timestamp associated with this frameisSystemTimestamp
- whether image's timestamp is in the same timebase asSystemClock.elapsedRealtimeNanos()
- See Also:
CameraCharacteristics.SENSOR_INFO_TIMESTAMP_SOURCE
-
updateIntrinsics
public void updateIntrinsics(int width, int height, float ppx, float ppy, float fx, float fy, float[] distortionCoeffs, boolean isMirrored)
The following intrinsics are using the pinhole camera model.The principal point offset is measured from the top-left corner of the image frame.
- Parameters:
width
- width of the image in pixelsheight
- height of the image in pixelsppx
- X offset of the principal pointppy
- Y offset of the principal pointfx
- X pixel focal lengthfy
- Y pixel focal lengthdistortionCoeffs
- OpenCV-style distortion coefficientsisMirrored
- whether the image is mirrored
-
-