fg
index
/usr/local/lib/python3.7/dist-packages/fg.cpython-37m-aarch64-linux-gnu.so

The fg module provides Python bindings for the FGCamera library.
 
The functions in the C API are implemented by the Python module 'fg'.
The Pyton help briefly describes the function arguments and return values.
Take a look at the library documentation for a detailed description:
http://api.imago.tech/FGCamera
 
API Differences
---------------
 
* C API:
    - All functions return a UINT32 value to indicate the status of each function.
    - Additional function results are returned by passing pointer arguments.
* Python API:
    - Functions will raise a Python exception in case of an error.
    - Function results are regular return values of the function.
      Mupltiple result values are returned as a tuple.
    - Image buffers are represented by the 'voidptrobject which implements
      the Python buffer protocol.
    - Enumerations are implemented by enum.Enum objects.
 
Example
-------
 
    # Import the fg module:
    import fg
 
    print("Initializing grabber...")
 
    # initialize the camera using automatic type detection
    fg.install_camera(fg.CAMERA_TYPE.Vxx_AUTO)
 
    # set sensor AOI and pixel format if desired:
    # fg.set_scan_param(x, y, width, height, 1, fg.PIXEL_TYPE.Y_8)
 
    # set the exposure time:
    fg.set_shutter_time(1000)
 
    # Get the size of the sensor
    result = fg.get_image_size()
    width = result[0]
    height = result[1]
 
    # allocate image buffers
    imageList = []
    for i in range(4):
        imageList.append(fg.alloc_image())
 
    # add buffers to the acquisition queue
    for image in imageList:
        fg.append_image(image)
 
    # set trigger mode to free-run
    fg.set_trigger_mode(fg.TRIGGER_MODE.FREERUN)
 
    print("Starting acquisition loop, press CTRL-C to stop the program.");
    while True:
        try:
            # wait for the next frame
            result = fg.get_image(1000)
            error = result[0]
            if error == fg.ERROR_CODE.NoError:
                ptr = result[1]
                image_number = result[2]
                if (image_number % 100) == 0:
                    print("Frame: {}".format(image_number))
 
                # todo: work with the image data.
                # For example, convert to numpy array:
                # image = numpy.ndarray((height, width), dtype=np.uint8, buffer=ptr)
 
                # add buffer to the acquisition queue again
                fg.append_image(ptr);
            elif error == fg.ERROR_CODE.BrokenImage:
                # the buffer is valid, but the contents are invalid
                print("get_image() returned a broken image")
                ptr = result[1]
                fg.append_image(ptr);
            elif error == fg.ERROR_CODE.GrabTimeOut:
                # timout occured, the image is invalid
                print("get_image() timeout occured")
            else:
                # other errors
                print("get_image() failed, error code: {}".format(error))
        except KeyboardInterrupt:
            print("Stopping acquisition")
            break
 
    # abort image acquisition
    fg.stop_image()
 
    # free buffers
    for image in imageList:
        fg.free_image(image)
 
    # close the camera
    fg.uninstall_camera()

 
Classes
       
builtins.object
.array
.simplewrapper
.wrapper
.voidptr
builtins.type(builtins.object)
.wrappertype
enum.Enum(builtins.object)
CAMERA_TYPE
ERROR_CODE
PIXEL_ORDER
PIXEL_TYPE
TRIGGER_MODE

 
class CAMERA_TYPE(enum.Enum)
    CAMERA_TYPE(value, names=None, *, module=None, qualname=None, type=None, start=1)
 
An enumeration.
 
 
Method resolution order:
CAMERA_TYPE
enum.Enum
builtins.object

Data and other attributes defined here:
CCVS1STMU0300A = <CAMERA_TYPE.CCVS1STMU0300A: 18>
FILE_BMP = <CAMERA_TYPE.FILE_BMP: 26>
VCx_AUTO = <CAMERA_TYPE.VCx_AUTO: 1>
VCx_DR2K7 = <CAMERA_TYPE.VCx_DR2K7: 10>
VCx_DR2X2K7 = <CAMERA_TYPE.VCx_DR2X2K7: 14>
VCx_DR2X2K7_RGB = <CAMERA_TYPE.VCx_DR2X2K7_RGB: 16>
VCx_DR2X4K7 = <CAMERA_TYPE.VCx_DR2X4K7: 15>
VCx_DR2X4K7_RGB = <CAMERA_TYPE.VCx_DR2X4K7_RGB: 17>
VCx_DR4K35 = <CAMERA_TYPE.VCx_DR4K35: 12>
VCx_DR4K7 = <CAMERA_TYPE.VCx_DR4K7: 11>
VCx_DR8K35 = <CAMERA_TYPE.VCx_DR8K35: 13>
VCx_EV76C560C = <CAMERA_TYPE.VCx_EV76C560C: 5>
VCx_EV76C560M = <CAMERA_TYPE.VCx_EV76C560M: 4>
VCx_EV76C570C = <CAMERA_TYPE.VCx_EV76C570C: 7>
VCx_EV76C570M = <CAMERA_TYPE.VCx_EV76C570M: 6>
VCx_L181C = <CAMERA_TYPE.VCx_L181C: 30>
VCx_L181M = <CAMERA_TYPE.VCx_L181M: 29>
VCx_MT9V032C = <CAMERA_TYPE.VCx_MT9V032C: 3>
VCx_MT9V032M = <CAMERA_TYPE.VCx_MT9V032M: 2>
VCx_NOIP3SE5000A = <CAMERA_TYPE.VCx_NOIP3SE5000A: 9>
VCx_NOIP3SN5000A = <CAMERA_TYPE.VCx_NOIP3SN5000A: 8>
VSx_AUTO = <CAMERA_TYPE.VSx_AUTO: 19>
VSx_EV2S02MB = <CAMERA_TYPE.VSx_EV2S02MB: 22>
VSx_EV2S02MC = <CAMERA_TYPE.VSx_EV2S02MC: 23>
VSx_EV2S05MB = <CAMERA_TYPE.VSx_EV2S05MB: 24>
VSx_EV2S05MC = <CAMERA_TYPE.VSx_EV2S05MC: 25>
VSx_IMX296LL = <CAMERA_TYPE.VSx_IMX296LL: 27>
VSx_MT9V032C = <CAMERA_TYPE.VSx_MT9V032C: 21>
VSx_MT9V032M = <CAMERA_TYPE.VSx_MT9V032M: 20>
Vxx_AUTO = <CAMERA_TYPE.Vxx_AUTO: 0>

Data descriptors inherited from enum.Enum:
name
The name of the Enum member.
value
The value of the Enum member.

Data descriptors inherited from enum.EnumMeta:
__members__
Returns a mapping of member name->value.
 
This mapping lists all enum members, including aliases. Note that this
is a read-only view of the internal mapping.

 
class ERROR_CODE(enum.Enum)
    ERROR_CODE(value, names=None, *, module=None, qualname=None, type=None, start=1)
 
An enumeration.
 
 
Method resolution order:
ERROR_CODE
enum.Enum
builtins.object

Data and other attributes defined here:
BrokenImage = <ERROR_CODE.BrokenImage: 6>
GrabTimeOut = <ERROR_CODE.GrabTimeOut: 5>
NoError = <ERROR_CODE.NoError: 0>

Data descriptors inherited from enum.Enum:
name
The name of the Enum member.
value
The value of the Enum member.

Data descriptors inherited from enum.EnumMeta:
__members__
Returns a mapping of member name->value.
 
This mapping lists all enum members, including aliases. Note that this
is a read-only view of the internal mapping.

 
class PIXEL_ORDER(enum.Enum)
    PIXEL_ORDER(value, names=None, *, module=None, qualname=None, type=None, start=1)
 
An enumeration.
 
 
Method resolution order:
PIXEL_ORDER
enum.Enum
builtins.object

Data and other attributes defined here:
BG = <PIXEL_ORDER.BG: 2>
GB = <PIXEL_ORDER.GB: 4>
GR = <PIXEL_ORDER.GR: 3>
RG = <PIXEL_ORDER.RG: 1>
RGB = <PIXEL_ORDER.RGB: 5>
Y = <PIXEL_ORDER.Y: 0>

Data descriptors inherited from enum.Enum:
name
The name of the Enum member.
value
The value of the Enum member.

Data descriptors inherited from enum.EnumMeta:
__members__
Returns a mapping of member name->value.
 
This mapping lists all enum members, including aliases. Note that this
is a read-only view of the internal mapping.

 
class PIXEL_TYPE(enum.Enum)
    PIXEL_TYPE(value, names=None, *, module=None, qualname=None, type=None, start=1)
 
An enumeration.
 
 
Method resolution order:
PIXEL_TYPE
enum.Enum
builtins.object

Data and other attributes defined here:
RGBX_32 = <PIXEL_TYPE.RGBX_32: 2>
RGB_24 = <PIXEL_TYPE.RGB_24: 3>
Y_16 = <PIXEL_TYPE.Y_16: 1>
Y_8 = <PIXEL_TYPE.Y_8: 0>

Data descriptors inherited from enum.Enum:
name
The name of the Enum member.
value
The value of the Enum member.

Data descriptors inherited from enum.EnumMeta:
__members__
Returns a mapping of member name->value.
 
This mapping lists all enum members, including aliases. Note that this
is a read-only view of the internal mapping.

 
class TRIGGER_MODE(enum.Enum)
    TRIGGER_MODE(value, names=None, *, module=None, qualname=None, type=None, start=1)
 
An enumeration.
 
 
Method resolution order:
TRIGGER_MODE
enum.Enum
builtins.object

Data and other attributes defined here:
FREERUN = <TRIGGER_MODE.FREERUN: 2>
HARDWARE = <TRIGGER_MODE.HARDWARE: 1>
SOFTWARE = <TRIGGER_MODE.SOFTWARE: 0>

Data descriptors inherited from enum.Enum:
name
The name of the Enum member.
value
The value of the Enum member.

Data descriptors inherited from enum.EnumMeta:
__members__
Returns a mapping of member name->value.
 
This mapping lists all enum members, including aliases. Note that this
is a read-only view of the internal mapping.

 
class array(builtins.object)
     Methods defined here:
__delitem__(self, key, /)
Delete self[key].
__getitem__(self, key, /)
Return self[key].
__len__(self, /)
Return len(self).
__repr__(self, /)
Return repr(self).
__setitem__(self, key, value, /)
Set self[key] to value.

Static methods defined here:
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.

 
class simplewrapper(builtins.object)
     Methods defined here:
__init__(self, /, *args, **kwargs)
Initialize self.  See help(type(self)) for accurate signature.

Static methods defined here:
__new__(*args, **kwargs) from .wrappertype
Create and return a new object.  See help(type) for accurate signature.

Data descriptors defined here:
__dict__

 
class voidptr(builtins.object)
     Methods defined here:
__bool__(self, /)
self != 0
__delitem__(self, key, /)
Delete self[key].
__getitem__(self, key, /)
Return self[key].
__int__(self, /)
int(self)
__len__(self, /)
Return len(self).
__setitem__(self, key, value, /)
Set self[key] to value.
asarray(...)
ascapsule(...)
asstring(...)
getsize(...)
getwriteable(...)
setsize(...)
setwriteable(...)

Static methods defined here:
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.

 
class wrapper(simplewrapper)
    
Method resolution order:
wrapper
simplewrapper
builtins.object

Methods inherited from simplewrapper:
__init__(self, /, *args, **kwargs)
Initialize self.  See help(type(self)) for accurate signature.

Static methods inherited from simplewrapper:
__new__(*args, **kwargs) from .wrappertype
Create and return a new object.  See help(type) for accurate signature.

Data descriptors inherited from simplewrapper:
__dict__

 
class wrappertype(builtins.type)
    type(object_or_name, bases, dict)
type(object) -> the object's type
type(name, bases, dict) -> a new type
 
 
Method resolution order:
wrappertype
builtins.type
builtins.object

Methods defined here:
__delattr__(self, name, /)
Implement delattr(self, name).
__getattribute__(self, name, /)
Return getattr(self, name).
__init__(self, /, *args, **kwargs)
Initialize self.  See help(type(self)) for accurate signature.
__setattr__(self, name, value, /)
Implement setattr(self, name, value).

Methods inherited from builtins.type:
__call__(self, /, *args, **kwargs)
Call self as a function.
__dir__(self, /)
Specialized __dir__ implementation for types.
__instancecheck__(self, instance, /)
Check if an object is an instance.
__repr__(self, /)
Return repr(self).
__sizeof__(self, /)
Return memory consumption of the type object.
__subclasscheck__(self, subclass, /)
Check if a class is a subclass.
__subclasses__(self, /)
Return a list of immediate subclasses.
mro(self, /)
Return a type's method resolution order.

Class methods inherited from builtins.type:
__prepare__(...) from builtins.type
__prepare__() -> dict
used to create the namespace for the class statement

Static methods inherited from builtins.type:
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.

Data descriptors inherited from builtins.type:
__abstractmethods__
__dict__
__text_signature__

Data and other attributes inherited from builtins.type:
__base__ = <class 'type'>
type(object_or_name, bases, dict)
type(object) -> the object's type
type(name, bases, dict) -> a new type
__bases__ = (<class 'type'>,)
__basicsize__ = 904
__dictoffset__ = 264
__flags__ = 2148291584
__itemsize__ = 40
__mro__ = (<class '.wrappertype'>, <class 'type'>, <class 'object'>)
__weakrefoffset__ = 368

 
Functions
       
alloc_image(...)
alloc_image() -> (voidptr)
 
Allocates and returns a image buffer for storing sensor frames.
 
The returned 'voidptrobject supports the Python buffer protocol.
append_image(...)
append_image(ptr: voidptr)
 
Puts an image buffer into the aquisition queue.
assign(...)
cast(...)
delete(...)
dump(...)
enableautoconversion(...)
free_image(...)
free_image(ptr: voidptr)
 
Releases an image buffer.
get_aoi(...)
get_aoi() -> (int, int, int, int, PIXEL_TYPE)
 
Returns the area of interest and the output format.
 
The function returns the following values:
 - [0]: AOI starting column
 - [1]: AOI starting row
 - [2]: AOI width
 - [3]: AOI height
 - [4]: Pixel format
get_black(...)
get_black() -> int
 
Returns the normalized black level.
get_camera_type(...)
get_camera_type() -> CAMERA_TYPE
 
Returns the installed camera type.
get_gain(...)
get_gain() -> int
 
Returns the normalized gain value.
get_gain_rgb(...)
get_gain_rgb() -> (int, int, int)
 
Returns the normalized color gain values for supported hardware.
get_image(...)
get_image(TimeOut_ms: int) -> (ERROR_CODEvoidptr, int)
 
Returns captured images to the user.
 
The function returns the following values:
 - [0]: error code, can be NoError, GrabTimeOut or BrokenImage
 - [1]: image buffer object, not valid if the error code is GrabTimeOut
 - [2]: image number, only valid if the error code is NoError
get_image_size(...)
get_image_size() -> (int, int, int)
 
Returns the size of the image buffers.
 
The function returns the following values:
 - [0]: image width in pixels
 - [1]: image height in pixels
 - [2]: image size in bytes
get_pixel_order(...)
get_pixel_order() -> PIXEL_ORDER
 
Returns the order of pixel components within image buffers.
get_scan_param(...)
get_scan_param() -> (int, int, int, int, int, PIXEL_TYPE)
 
Returns the area of interest and the output format.
 
The function returns the following values:
 - [0]: Sensor AOI starting column
 - [1]: Sensor AOI starting row
 - [2]: Sensor AOI width
 - [3]: Sensor AOI height
 - [4]: Number of sensor scans to complete one image
 - [5]: Pixel format
get_shutter_time(...)
get_shutter_time() -> int
 
Returns the exposure time in microseconds.
get_special_option(...)
get_special_option(option: Optional[str]) -> int
 
Returns a special camera property. 
 
option: Propery name
get_timestamp(...)
get_timestamp(ptr: voidptr) -> (long long)
 
Returns the image completion timestamp of a captured image.
get_trigger_mode(...)
get_trigger_mode() -> TRIGGER_MODE
 
Returns the configured trigger mode.
get_version(...)
get_version() -> (int, int, int, int)
 
Returns the library version.
 
The function returns to following values:
 - [0]: Major version
 - [1]: Minor version
 - [2]: Patch level
 - [3]: Build number
install_camera(...)
install_camera(camera_type: CAMERA_TYPE = CAMERA_TYPE.Vxx_AUTO)
 
Opens and initializes the camera.
 
camera_type: Selects the camera type to use.
isdeleted(...)
ispycreated(...)
ispyowned(...)
save_image(...)
save_image(ptr: voidptr, filename: Optional[str])
 
Saves the given image into an BMP file.
 
ptr:        Image pointer
filename:   File name
set_aoi(...)
set_aoi(x1: int, y1: int, x2: int, y2: int, pixel_type: PIXEL_TYPE)
 
Sets the area of interest and the output format.
set_black(...)
set_black(black: int)
 
Sets the black level using a normalized value.
set_gain(...)
set_gain(gain: int)
 
Sets the gain using a normalized value.
set_gain_rgb(...)
set_gain_rgb(gain_red: int, gain_green: int, gain_blue: int)
 
Sets the color component gain values for supported hardware.
set_scan_param(...)
set_scan_param(scan_x: int, scan_y: int, scan_width: int, scan_height: int, image_scan_count: int, pixel_type: PIXEL_TYPE)
 
Sets the area of interest and output format.
 
scan_x:           Sensor AOI starting column
scan_y:           Sensor AOI starting row
scan_width:       Sensor AOI width
scan_height:      Sensor AOI height
image_scan_count: Number of sensor scans to complete one image
pixel_type:       Pixel format
set_shutter_time(...)
set_shutter_time(shutter_time_us: int)
 
Sets the exposure time in microseconds.
set_special_option(...)
set_special_option(option: Optional[str], arg: int)
 
Configures a special camera property. 
 
option: Propery name
arg:    Property value
set_trigger_mode(...)
set_trigger_mode(trigger_mode: TRIGGER_MODE)
 
Sets the trigger mode.
setdeleted(...)
settracemask(...)
stop_image(...)
stop_image()
 
Forces the camera to stop grabbing and using any buffers.
transferback(...)
transferto(...)
trigger_image(...)
trigger_image()
 
Triggers the next image in software triggered mode.
uninstall_camera(...)
uninstall_camera()
 
Closes the camera.
unwrapinstance(...)
wrapinstance(...)

 
Data
        SIP_VERSION = 395020
SIP_VERSION_STR = '6.7.12'