Interface OpenpnpCaptureLibrary

    • Field Detail

      • JNA_NATIVE_LIB

        static final com.sun.jna.NativeLibrary JNA_NATIVE_LIB
      • CAPPROPID_EXPOSURE

        static final int CAPPROPID_EXPOSURE
        native declaration : openpnp-capture/include/openpnp-capture.h
        See Also:
        Constant Field Values
      • CAPPROPID_FOCUS

        static final int CAPPROPID_FOCUS
        native declaration : openpnp-capture/include/openpnp-capture.h
        See Also:
        Constant Field Values
      • CAPPROPID_ZOOM

        static final int CAPPROPID_ZOOM
        native declaration : openpnp-capture/include/openpnp-capture.h
        See Also:
        Constant Field Values
      • CAPPROPID_WHITEBALANCE

        static final int CAPPROPID_WHITEBALANCE
        native declaration : openpnp-capture/include/openpnp-capture.h
        See Also:
        Constant Field Values
      • CAPPROPID_GAIN

        static final int CAPPROPID_GAIN
        native declaration : openpnp-capture/include/openpnp-capture.h
        See Also:
        Constant Field Values
      • CAPPROPID_BRIGHTNESS

        static final int CAPPROPID_BRIGHTNESS
        native declaration : openpnp-capture/include/openpnp-capture.h
        See Also:
        Constant Field Values
      • CAPPROPID_CONTRAST

        static final int CAPPROPID_CONTRAST
        native declaration : openpnp-capture/include/openpnp-capture.h
        See Also:
        Constant Field Values
      • CAPPROPID_SATURATION

        static final int CAPPROPID_SATURATION
        native declaration : openpnp-capture/include/openpnp-capture.h
        See Also:
        Constant Field Values
      • CAPPROPID_GAMMA

        static final int CAPPROPID_GAMMA
        native declaration : openpnp-capture/include/openpnp-capture.h
        See Also:
        Constant Field Values
      • CAPPROPID_HUE

        static final int CAPPROPID_HUE
        native declaration : openpnp-capture/include/openpnp-capture.h
        See Also:
        Constant Field Values
      • CAPPROPID_SHARPNESS

        static final int CAPPROPID_SHARPNESS
        native declaration : openpnp-capture/include/openpnp-capture.h
        See Also:
        Constant Field Values
      • CAPPROPID_BACKLIGHTCOMP

        static final int CAPPROPID_BACKLIGHTCOMP
        native declaration : openpnp-capture/include/openpnp-capture.h
        See Also:
        Constant Field Values
      • CAPPROPID_POWERLINEFREQ

        static final int CAPPROPID_POWERLINEFREQ
        native declaration : openpnp-capture/include/openpnp-capture.h
        See Also:
        Constant Field Values
      • CAPPROPID_LAST

        static final int CAPPROPID_LAST
        native declaration : openpnp-capture/include/openpnp-capture.h
        See Also:
        Constant Field Values
      • CAPRESULT_OK

        static final int CAPRESULT_OK
        native declaration : openpnp-capture/include/openpnp-capture.h
        See Also:
        Constant Field Values
      • CAPRESULT_ERR

        static final int CAPRESULT_ERR
        native declaration : openpnp-capture/include/openpnp-capture.h
        See Also:
        Constant Field Values
      • CAPRESULT_DEVICENOTFOUND

        static final int CAPRESULT_DEVICENOTFOUND
        native declaration : openpnp-capture/include/openpnp-capture.h
        See Also:
        Constant Field Values
      • CAPRESULT_FORMATNOTSUPPORTED

        static final int CAPRESULT_FORMATNOTSUPPORTED
        native declaration : openpnp-capture/include/openpnp-capture.h
        See Also:
        Constant Field Values
      • CAPRESULT_PROPERTYNOTSUPPORTED

        static final int CAPRESULT_PROPERTYNOTSUPPORTED
        native declaration : openpnp-capture/include/openpnp-capture.h
        See Also:
        Constant Field Values
    • Method Detail

      • Cap_createContext

        com.sun.jna.Pointer Cap_createContext()
        Initialize the capture library
        Returns:
        The context ID.
        Original signature : CapContext Cap_createContext()
        native declaration : openpnp-capture/include/openpnp-capture.h:112
      • Cap_releaseContext

        int Cap_releaseContext​(com.sun.jna.Pointer ctx)
        Un-initialize the capture library context
        Parameters:
        ctx - The ID of the context to destroy.
        Returns:
        The context ID.
        Original signature : CapResult Cap_releaseContext(CapContext)
        native declaration : openpnp-capture/include/openpnp-capture.h:118
      • Cap_getDeviceCount

        int Cap_getDeviceCount​(com.sun.jna.Pointer ctx)
        Get the number of capture devices on the system.
        note: this can change dynamically due to the
        pluggin and unplugging of USB devices.
        Parameters:
        ctx - The ID of the context.
        Returns:
        The number of capture devices found.
        Original signature : uint32_t Cap_getDeviceCount(CapContext)
        native declaration : openpnp-capture/include/openpnp-capture.h:126
      • Cap_getDeviceName

        com.sun.jna.Pointer Cap_getDeviceName​(com.sun.jna.Pointer ctx,
                                              int index)
        Get the name of a capture device.
        This name is meant to be displayed in GUI applications,
        i.e. its human readable.
        if a device with the given index does not exist,
        NULL is returned.
        Parameters:
        ctx - The ID of the context.
        index - The device index of the capture device.
        Returns:
        a pointer to an UTF-8 string containting the name of the capture device.
        Original signature : char* Cap_getDeviceName(CapContext, CapDeviceID)
        native declaration : openpnp-capture/include/openpnp-capture.h:138
      • Cap_getDeviceUniqueID

        com.sun.jna.Pointer Cap_getDeviceUniqueID​(com.sun.jna.Pointer ctx,
                                                  int index)
        Get the unique name of a capture device.
        The string contains a unique concatenation
        of the device name and other parameters.
        These parameters are platform dependent.
        Note: when a USB camera does not expose a serial number,
        platforms might have trouble uniquely identifying
        a camera. In such cases, the USB port location can
        be used to add a unique feature to the string.
        This, however, has the down side that the ID of
        the camera changes when the USB port location
        changes. Unfortunately, there isn't much to
        do about this.
        if a device with the given index does not exist,
        NULL is returned.
        Parameters:
        ctx - The ID of the context.
        index - The device index of the capture device.
        Returns:
        a pointer to an UTF-8 string containting the unique ID of the capture device.
        Original signature : char* Cap_getDeviceUniqueID(CapContext, CapDeviceID)
        native declaration : openpnp-capture/include/openpnp-capture.h:160
      • Cap_getNumFormats

        int Cap_getNumFormats​(com.sun.jna.Pointer ctx,
                              int index)
        Returns the number of formats supported by a certain device.
        returns -1 if device does not exist.
        Parameters:
        ctx - The ID of the context.
        index - The device index of the capture device.
        Returns:
        The number of formats supported or -1 if the device does not exist.
        Original signature : int32_t Cap_getNumFormats(CapContext, CapDeviceID)
        native declaration : openpnp-capture/include/openpnp-capture.h:170
      • Cap_getFormatInfo

        int Cap_getFormatInfo​(com.sun.jna.Pointer ctx,
                              int index,
                              int id,
                              CapFormatInfo info)
        Get the format information from a device.
        Parameters:
        ctx - The ID of the context.
        index - The device index of the capture device.
        id - The index/ID of the frame buffer format (0 .. number returned by Cap_getNumFormats() minus 1 ).
        info - pointer to a CapFormatInfo structure to be filled with data.
        Returns:
        The CapResult.
        Original signature : CapResult Cap_getFormatInfo(CapContext, CapDeviceID, CapFormatID, CapFormatInfo*)
        native declaration : openpnp-capture/include/openpnp-capture.h:179
      • Cap_openStream

        int Cap_openStream​(com.sun.jna.Pointer ctx,
                           int index,
                           int formatID)
        Open a capture stream to a device with specific format requirements
        Although the (internal) frame buffer format is set via the fourCC ID,
        the frames returned by Cap_captureFrame are always 24-bit RGB.
        Parameters:
        ctx - The ID of the context.
        index - The device index of the capture device.
        formatID - The index/ID of the frame buffer format (0 .. number returned by Cap_getNumFormats() minus 1 ).
        Returns:
        The stream ID or -1 if the device does not exist or the stream format ID is incorrect.
        Original signature : CapStream Cap_openStream(CapContext, CapDeviceID, CapFormatID)
        native declaration : openpnp-capture/include/openpnp-capture.h:196
      • Cap_closeStream

        int Cap_closeStream​(com.sun.jna.Pointer ctx,
                            int stream)
        Close a capture stream
        Parameters:
        ctx - The ID of the context.
        stream - The stream ID.
        Returns:
        CapResult
        Original signature : CapResult Cap_closeStream(CapContext, CapStream)
        native declaration : openpnp-capture/include/openpnp-capture.h:203
      • Cap_isOpenStream

        int Cap_isOpenStream​(com.sun.jna.Pointer ctx,
                             int stream)
        Check if a stream is open, i.e. is capturing data.
        Parameters:
        ctx - The ID of the context.
        stream - The stream ID.
        Returns:
        1 if the stream is open and capturing, else 0.
        Original signature : uint32_t Cap_isOpenStream(CapContext, CapStream)
        native declaration : openpnp-capture/include/openpnp-capture.h:210
      • Cap_captureFrame

        int Cap_captureFrame​(com.sun.jna.Pointer ctx,
                             int stream,
                             com.sun.jna.Pointer RGBbufferPtr,
                             int RGBbufferBytes)
        this function copies the most recent RGB frame data
        to the given buffer.
        Original signature : CapResult Cap_captureFrame(CapContext, CapStream, void*, uint32_t)
        native declaration : openpnp-capture/include/openpnp-capture.h:219
      • Cap_hasNewFrame

        int Cap_hasNewFrame​(com.sun.jna.Pointer ctx,
                            int stream)
        returns 1 if a new frame has been captured, 0 otherwise
        Original signature : uint32_t Cap_hasNewFrame(CapContext, CapStream)
        native declaration : openpnp-capture/include/openpnp-capture.h:222
      • Cap_getStreamFrameCount

        int Cap_getStreamFrameCount​(com.sun.jna.Pointer ctx,
                                    int stream)
        returns the number of frames captured during the lifetime of the stream.
        For debugging purposes
        Original signature : uint32_t Cap_getStreamFrameCount(CapContext, CapStream)
        native declaration : openpnp-capture/include/openpnp-capture.h:226
      • Cap_getPropertyLimits

        int Cap_getPropertyLimits​(com.sun.jna.Pointer ctx,
                                  int stream,
                                  int propID,
                                  IntBuffer min,
                                  IntBuffer max,
                                  IntBuffer dValue)
        get the min/max limits and default value of a camera/stream property (e.g. zoom, exposure etc)
        returns: CAPRESULT_OK if all is well.
        CAPRESULT_PROPERTYNOTSUPPORTED if property not available.
        CAPRESULT_ERR if context, stream are invalid.
        Original signature : CapResult Cap_getPropertyLimits(CapContext, CapStream, CapPropertyID, int32_t*, int32_t*, int*)
        native declaration : openpnp-capture/include/openpnp-capture.h:239
      • Cap_setProperty

        int Cap_setProperty​(com.sun.jna.Pointer ctx,
                            int stream,
                            int propID,
                            int value)
        set the value of a camera/stream property (e.g. zoom, exposure etc)
        returns: CAPRESULT_OK if all is well.
        CAPRESULT_PROPERTYNOTSUPPORTED if property not available.
        CAPRESULT_ERR if context, stream are invalid.
        Original signature : CapResult Cap_setProperty(CapContext, CapStream, CapPropertyID, int32_t)
        native declaration : openpnp-capture/include/openpnp-capture.h:248
      • Cap_setAutoProperty

        int Cap_setAutoProperty​(com.sun.jna.Pointer ctx,
                                int stream,
                                int propID,
                                int bOnOff)
        set the automatic flag of a camera/stream property (e.g. zoom, focus etc)
        returns: CAPRESULT_OK if all is well.
        CAPRESULT_PROPERTYNOTSUPPORTED if property not available.
        CAPRESULT_ERR if context, stream are invalid.
        Original signature : CapResult Cap_setAutoProperty(CapContext, CapStream, CapPropertyID, uint32_t)
        native declaration : openpnp-capture/include/openpnp-capture.h:256
      • Cap_getProperty

        int Cap_getProperty​(com.sun.jna.Pointer ctx,
                            int stream,
                            int propID,
                            IntBuffer outValue)
        get the value of a camera/stream property (e.g. zoom, exposure etc)
        returns: CAPRESULT_OK if all is well.
        CAPRESULT_PROPERTYNOTSUPPORTED if property not available.
        CAPRESULT_ERR if context, stream are invalid or outValue == NULL.
        Original signature : CapResult Cap_getProperty(CapContext, CapStream, CapPropertyID, int32_t*)
        native declaration : openpnp-capture/include/openpnp-capture.h:264
      • Cap_getAutoProperty

        int Cap_getAutoProperty​(com.sun.jna.Pointer ctx,
                                int stream,
                                int propID,
                                IntBuffer outValue)
        get the automatic flag of a camera/stream property (e.g. zoom, focus etc)
        returns: CAPRESULT_OK if all is well.
        CAPRESULT_PROPERTYNOTSUPPORTED if property not available.
        CAPRESULT_ERR if context, stream are invalid.
        Original signature : CapResult Cap_getAutoProperty(CapContext, CapStream, CapPropertyID, uint32_t*)
        native declaration : openpnp-capture/include/openpnp-capture.h:272
      • Cap_setLogLevel

        void Cap_setLogLevel​(int level)
        Set the logging level.
        LOG LEVEL ID | LEVEL
        ------------- | -------------
        LOG_EMERG | 0
        LOG_ALERT | 1
        LOG_CRIT | 2
        LOG_ERR | 3
        LOG_WARNING | 4
        LOG_NOTICE | 5
        LOG_INFO | 6
        LOG_DEBUG | 7
        LOG_VERBOSE | 8
        Original signature : void Cap_setLogLevel(uint32_t)
        native declaration : openpnp-capture/include/openpnp-capture.h:294
      • Cap_installCustomLogFunction

        void Cap_installCustomLogFunction​(OpenpnpCaptureLibrary.CapCustomLogFunc logFunc)
        install a custom callback for a logging function.
        the callback function must have the following
        structure:
        void func(uint32_t level, const char *string);
        Original signature : void Cap_installCustomLogFunction(CapCustomLogFunc)
        native declaration : openpnp-capture/include/openpnp-capture.h:306
      • Cap_getLibraryVersion

        com.sun.jna.Pointer Cap_getLibraryVersion()
        Return the version of the library as a string.
        In addition to a version number, this should
        contain information on the platform,
        e.g. Win32/Win64/Linux32/Linux64/OSX etc,
        wether or not it is a release or debug
        build and the build date.
        When building the library, please set the
        following defines in the build environment:
        __LIBVER__
        __PLATFORM__
        __BUILDTYPE__
        Original signature : char* Cap_getLibraryVersion()
        native declaration : openpnp-capture/include/openpnp-capture.h:324