Package com.leia.core

Class 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 Detail

      • SharedCameraSink

        public SharedCameraSink​(long coreLib)
    • Method Detail

      • close

        public void close()
        Release the instance.
      • onLux

        public void onLux​(float lux)
        Notify lux value change.
      • 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) image
        pixelStride - distance between adjacent pixel samples, in bytes
        rowStride - row stride for imageBuffer, in bytes
        rotation - camera frame rotation
        timestamp - timestamp associated with this frame
        isSystemTimestamp - whether image's timestamp is in the same timebase as SystemClock.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 pixels
        height - height of the image in pixels
        ppx - X offset of the principal point
        ppy - Y offset of the principal point
        fx - X pixel focal length
        fy - Y pixel focal length
        distortionCoeffs - OpenCV-style distortion coefficients
        isMirrored - whether the image is mirrored