Bindings

Provides the cython bindings to the corresponding c functions.

Functions that are not implemented:

fc2SetUserBuffers
class pyflycap2.interface.Camera

Bases: pyflycap2.interface.CameraContext

Represents a Point Gray camera connected on the bus.

Each Camera instance derives from CameraContext since each camera requires a controller.

At least one of the parameters must be provided.

Parameters
guid: list

A list of size 4 representing the GUID of the camera. Can be None (default).

index: int

The index of the camera on the bus. Can be None (default).

ip: list

A list of size 4 representing the IP of the camera. Can be None (default).

serial: int

The serial number of the camera on the bus. Can be None (default).

check_video_mode(self, width, height, fmt, rate)

Checks whether the input parameters are supported.

Allowed values are listed in set_video_mode().

connect(self)

Connects the camera represented by the instance.

connected

connected: object If the Camera is currently connected to its internal CameraContext.

disconnect(self)

Disconnects the camera represented by the instance.

gateway

gateway: list A list of size 4 representing the gateway of the Camera or None.

get_cam_abs_setting_range(self, setting)

Returns the absolute (min, max) values of the setting.

get_cam_abs_setting_value(self, setting)

Returns the absolute value of the setting.

get_cam_setting_abilities(self, setting)
get_cam_setting_option_values(self, setting)

Gets the setting options.

get_current_image(self)

Returns the last read frame.

It’s a bytearray of size data_size as returned by get_current_image_config().

get_current_image_config(self)

Returns the configuration parameters of the last read image.

Its keys are 'rows', 'cols', 'stride', 'data_size', 'received_size', 'pix_fmt', 'bayer_fmt', 'ts'.

The value of 'ts' is a TimeStamp instance.

get_drop_mode(self)

Returns True if the camera will drop frames rather than buffer it.

get_fmt7_config(self)

Returns a 3-tuple of the current fmt7 config.

The tuple is (dict, size, percentage). The dict is a dict with keys 'mode', 'offset_x', 'offset_y', 'width', 'height', 'fmt'.

get_fmt7_specs(self)

Returns the specs of the fmt7 configuration.

The returned value is a dict whose keys are its modes and whose values is each a dict describing the mode. The keys of the individual dicts are

'max_width', 'max_height', 'h_offset_step', 'v_offset_step', 'h_image_step', 'v_image_step', 'pix_fmt_bit_field', 'vender_pix_fmt_bit_field', 'packet_size', 'min_packet_size', 'max_packet_size', 'percentage'.

get_gige_binning(self)

Returns a 2-tuple of the horizontal and vertical pixel binning.

get_gige_config(self)

Returns the current GigE configuration.

Returns a dict whose keys are 'offset_x', 'offset_y', 'width', 'height', 'fmt'.

get_gige_mode(self)

Gets the current GigE camera mode.

get_gige_num_streams(self)

Gets the number of stream for the camera.

get_gige_packet_config(self)

Returns a dict with the bus video packet config. Its keys are 'resend', 'timeout_retries', 'timeout'.

get_gige_specs(self)

Gets the specs of the GigE camera.

Returns a dict whose keys are 'max_width', 'max_height', 'h_offset_step', 'v_offset_step', 'h_image_step', 'v_image_step', 'pix_fmt_bit_field', 'vender_pix_fmt_bit_field'.

get_gige_stream_config(self, unsigned int chan)

Returns a dict with the with information about the channel.

Its keys are 'net_index', 'host_port', 'frag', 'packet_size', 'delay', 'dest_ip', 'src_port'.

get_horizontal_mirror(self)

Returns tuple of (present, state). present indicates whether this feature is available for this camera. state is True if mirroring is curently on, otherwise it’s False.

get_register(self, unsigned int address)

Returns the current value from register address.

get_video_mode(self)

Returns a 4 tuple of (width, height, pixel_fomrat, rate).

Values are similar to those listed in set_video_mode().

guid

guid: list A list of size 4 representing the GUID of the Camera or None.

index

index: ‘unsigned int’ The index of the camera on the bus.

interface_type

interface_type: object The Camera interface type. Can be one of IEEE1394, USB2, USB3, GigE, or unknown.

ip

ip: list A list of size 4 representing the ip of the Camera or None.

is_color

is_color: object Whether the Camera is color or B/W.

is_controlable(self)

Returns whether the camera is controllable by the controller.

mac_address

mac_address: list A list of size 6 representing the MAC address of the Camera or None.

read_next_image(self)

Requests that the next acquired frame be read fro the bus.

save_current_image(self, filename, ext='auto')

Saves the last image read to disk.

ext is the extension type, defaults to 'auto'. Can be one of 'auto', 'pgm', 'ppm', 'bmp', 'jpeg', 'jpeg2000', 'tiff', 'png', 'raw'.

serial

serial: ‘unsigned int’ The serial number of the Camera.

set_cam_abs_setting_value(self, setting, value)

Returns the absolute value of the setting.

set_cam_setting_option_values(self, setting, abs=None, one_push=None, controllable=None, auto=None, relative_value=None)

Sets the setting options.

set_drop_mode(self, int drop=True)

Sets whether frames should be dropped or buffered and sent later when not retrieved quickly enough. drop defaults to True.

set_fmt7_config(self, mode, offset_x, offset_y, width, height, fmt, packet_size=None, packet_percentage=None)

Similar to get_fmt7_config().

set_gige_binning(self, unsigned int horizontal, unsigned int vertical)

Sets the horizontal and vertical pixel binning.

set_gige_config(self, offset_x, offset_y, width, height, fmt)

Sets the GigE configuration. Similar to get_gige_config().

set_gige_mode(self, mode)

Sets the GigE camera mode.

set_gige_packet_config(self, resend, timeout, timeout_retries)

Sets the bus video packet config. Similar to get_gige_packet_config().

set_gige_stream_config(self, unsigned int chan, net_index, host_port, frag, packet_size, delay, dest_ip, src_port)

Sets the stream configuration. Similar to get_gige_stream_config().

set_horizontal_mirror(self, value)

Sets whether horizontal mirroring should be turned ON or OFF assuming it’s available.

set_register(self, unsigned int address, unsigned int value)

Writes value to register address.

set_video_mode(self, width, height, fmt, rate)

Sets the camera to the input parameter values.

width, height is the frame sizes. fmt is the pixel format. Allowed values are '160x120 yuv444', '320x240 yuv422', '640x480 yuv411', '640x480 yuv422', '640x480 rgb', '640x480 y8', '640x480 y16', '800x600 yuv422', '800x600 rgb', '800x600 y8', '800x600 y16', '1024x768 yuv422', '1024x768 rgb', '1024x768 y8', '1024x768 y16', '1280x960 yuv422', '1280x960 rgb', '1280x960 y8', '1280x960 y16', '1600x1200 yuv422', '1600x1200 rgb', '1600x1200 y8', '1600x1200 y16'.

A fmt of 'fmt7' doesn’t have a preset frame size.

rate can be one of 1.875, 3.75, 7.5, 15, 30, 60, 120, 240. A rate of 'fmt7' doesn’t have a preset frame rate.

setting_names

setting_names: list A list of the names of the setting, e.g. brightness that are supported by

point gray cameras (even if this camera doesn’t support it).

start_capture(self)

Sets the camera to start capturing and acquiring frames.

start_capture_sync(self, other_cams)

Sets the camera to start capturing in sync with all the Camera instances listed in other_cams. All these cameras will start capturing simultaneously.

stop_capture(self)

Stops the camera from capturing frames.

subnet

subnet: list A list of size 4 representing the subnet of the Camera or None.

validate_fmt7_specs(self, mode, offset_x, offset_y, width, height, fmt)

Validates the fmt7 configuration for the mode. Similar to get_fmt7_specs() and get_fmt7_config().

verify_gige_mode(self, mode)

Checks if the GigE camera mode is supported.

class pyflycap2.interface.CameraContext

Bases: object

Base controller that interface with the bus to which the Camera devices are connected.

Parameters
context_type: str

Can be one of IIDC or GigE. Defaults to GigE.

context_type

context_type: object The bus type controlled by the context. Can be one of IIDC or GigE.

cycle_time(self)

Returns the current timestamp, as a TimeStamp, of the bus.

force_all_ips(self)

Automatically sets the ip, subnet, and gateway of all the connected GigE cameras.

force_mac_to_ip(self, ip, subnet, gateway, mac_address=None, Camera cam=None)

Sets the ip, subnet, and gateway (each a list of 4 integers) of the device at the corresponding MAC address to the provided values.

Either mac_address (list of 6 integers) or a Camera whose Camera.mac_address will be used must be provided.

get_bpp(self, fmt)

Returns the number of bits per pixel for the given format.

fmt can be one of 'mono8', 'yuv411', 'yuv422', 'yuv444', 'rgb8', 'mono16', 'rgb16', 's_mono16', 's_rgb16', 'raw8', 'raw16', 'mono12', 'raw12', 'bgr', 'bgru', 'rgb', 'rgbu', 'bgr16', 'bgru16', 'yuv422_jpeg'.

get_default_color_processing(self)

Returns the default color processing algorithm.

Can be one of 'default', 'no_processing', 'NN', 'edge', 'linear', 'rigorous', 'IPP', 'directional'.

get_default_pix_fmt(self)

Returns the default pixel format for the cameras.

Can be one of 'mono8', 'yuv411', 'yuv422', 'yuv444', 'rgb8', 'mono16', 'rgb16', 's_mono16', 's_rgb16', 'raw8', 'raw16', 'mono12', 'raw12', 'bgr', 'bgru', 'rgb', 'rgbu', 'bgr16', 'bgru16', 'yuv422_jpeg'.

get_device_guid_from_index(self, unsigned int index)

Returns a list of size 4 representing the GUID of the device at index index.

get_gige_cams(self)

Returns a list of the serial numbers of the connected GigE cameras.

get_num_cameras(self)

The number of cameras connected to the bus.

get_num_devices(self)

The number of devices connected to the bus.

rescan_bus(self)

Rescans the bus to discover new devices.

reset_1394(self, Camera camera)

Resets the 1394 bus associated with the Camera.

set_default_color_processing(self, algo)

Sets the default color processing algorithm.

Can be one of 'default', 'no_processing', 'NN', 'edge', 'linear', 'rigorous', 'IPP', 'directional'.

set_default_pix_fmt(self, fmt)

Sets the default pixel format for the cameras.

Can be one of 'mono8', 'yuv411', 'yuv422', 'yuv444', 'rgb8', 'mono16', 'rgb16', 's_mono16', 's_rgb16', 'raw8', 'raw16', 'mono12', 'raw12', 'bgr', 'bgru', 'rgb', 'rgbu', 'bgr16', 'bgru16', 'yuv422_jpeg'.

class pyflycap2.interface.GUI

Bases: object

Controls a GUI for configuring and selecting Point Gray cameras.

There are two GUI options, show() and show_selection().

connect_camera(self, Camera cam)

Connects the GUI to the provided Camera.

disconnect_camera(self)

Disconnects the Camera connected with connect_camera().

hide(self)

Hides the GUI shown with show().

is_gui_visible(self)

Returns whether the GUI is currently shown with show().

show(self)

Show the GUI for the Camera connected with connect_camera().

Currently this method may crash or freeze. As of 2016 it is a confirmed bug with the Point Gray C library.

show_selection(self)

Shows a non-specific GUI from which any of the cameras can be selected and configured.

Returns a 2-tuple of (selected, GUIDs). Selected is True if OK was pressed or False if it was canceled. GUIDs is a list of the GUIDs of all the selected cameras.