class Camera¶
- class scTDC.Camera(inifilepath='tdc_gpx3.ini', autoinit=True, lib=None)¶
Bases:
scTDC.Device
A specialization of the
Device
class that offers additional, camera-specific functions- add_frame_pipe()¶
Add a CamFramePipe pipe for receiving meta data and image data for individual camera frames.
- Returns
a tuple containing a pipe ID and the
CamFramePipe
object if successful; a tuple containing the error code and an error message in case of failure.- Return type
(int, CamFramePipe) | (int, str)
- add_blobs_pipe()¶
Add a CamBlobsPipe for receiving blob data for individual camera frames.
- Returns
a tuple containing a pipe ID and the
CamBlobsPipe
object if successful; a tuple containing the error code and an error message in case of failure.- Return type
(int, CamBlobsPipe) | (int, str)
- set_exposure_and_frames(exposure, nrframes)¶
Set the exposure per frame in microseconds and the number of frames
- Parameters
exposure (int) – the exposure per frame in microseconds
nrframes (int) – the number of frames
- Returns
(0, “”) on success or a tuple with negative error code and error message
- Return type
(int, str)
- get_max_size()¶
Get the maximum possible width and height for regions of interest (the width and height in pixels of the sensor area).
- Returns
a tuple (0, roi) where roi is a dictionary with keys ‘width’ and ‘height’ if successful, a tuple (error_code, error_message) in case of failure
- Return type
(int, dict) | (int, str)
- set_region_of_interest(xmin, xmax, ymin, ymax)¶
Set the region of interest.
- Parameters
xmin (int) – the position of the boundary to the left
xmax (int) – the position of the boundary to the right
ymin (int) – the position of the top boundary
ymax (int) – the position of the bottom boundary
- Returns
a tuple (0, “”) in case of success, or a tuple containing a negative error code and an error message
- Return type
(int, str)
- get_region_of_interest()¶
Get the currently set region of interest
- Returns
a tuple (0, roi) where roi is a dict with keywords ‘xmin’, ‘xmax’, ‘ymin’, ‘ymax’ if successful, a tuple containing error code and error message in case of failure
- Return type
(int, dict) | (int, str)
- set_fanspeed(fanspeed)¶
Set the fan speed
- Parameters
fanspeed (int) – the fan speed on a scale from 0 (off) to 255 (maximum)
- Returns
(0, “”) if successful; (error_code, error_message) in case of failure
- Return type
(int, str)
- set_blob_mode(blob_dif_min_top=1, blob_dif_min_bottom=3)¶
Activate blob mode. Refer to https://www.surface-concept.com/sctdc-sdk-doc/05_reconflex_cameras.html#blob-recognition-criteria, (condition 3 + 4) for explanation of the blob_dif_min_top/bottom parameters.
- Parameters
blob_dif_min_top (int) – allowed values range from 0 to 63
blob_dif_min_bottom (int) – allowed values range from 0 to 63
- Returns
(0, “”) if successful; (error_code, error_message) in case of failure
- Return type
(int, str)
- set_image_mode()¶
Deactivate blob mode.
- set_smoother_masks_square(size1=1, size2=1)¶
Set the smoother pixel masks to filled squares of specified sizes. Specifying both sizes as 1 results in no smoothing. Allowed values for each of the size parameters are 1, 2, 3, 4, 5.
- set_smoother_bit_shifts(shift1=0, shift2=0)¶
Set the smoother bit shifts applied to the intensity value after convolution with the smoother pixel mask after smoothing stages 1 and 2, respectively. Recommended shifts for square sizes used in set_smoother_masks_square are shift 0 for size 1, shift 2 for size 2, shift 3 for size 3, shift 4 for size 4, shift 4 or 5 for size 5.
- set_analog_gain(value)¶
Set the analog gain (a property of the sensor)
- Parameters
value (int) – the analog gain value ranging from 0 to 480
- Returns
(0, “”) in case of success; (error_code, error_message) in case of failure
- Return type
(int, str)
- get_analog_gain()¶
Get the currently set analog gain (a property of the sensor)
- Returns
A tuple (0, analog_gain) if successful; a tuple (error_code, error_message) in case of failure
- Return type
(int, int) | (int, str)
- set_black_offset(value)¶
Set the black offset (a property of the sensor)
- Parameters
value (int) – the black offset value ranging from 0 to 255 (in BitMode 8) or from 0 to 4095 (in BitMode 12).
- Returns
(0, “”) in case of success; (error_code, error_message) in case of failure
- Return type
(int, str)
- get_black_offset()¶
Get the currently set black offset (a property of the sensor)
- Returns
A tuple (0, black_offset) if successful; a tuple (error_code, error_message) in case of failure
- Return type
(int, int) | (int, str)
- set_white_pixel_min(value)¶
Set the ‘White Pixel Min’ parameter, a threshold criterion for filtering white pixels.
- Parameters
value (int) – the white pixel minimum value ranging from 0 to 255. 0 turns white pixel remover off. 1 is the lowest threshold (removes the most white pixels).
- Returns
(0, “”) in case of success; (error_code, error_message) in case of failure
- Return type
(int, str)
- get_white_pixel_min()¶
Get the current value of the ‘White Pixel Min’ parameter
- Returns
A tuple (0, white_pixel_min) if successful; a tuple (error_code, error_message) in case of failure
- Return type
(int, int) | (int, str)
- set_white_pixel_relax(value)¶
Set the ‘White Pixel Relax’ parameter, which controls a ratio between the center pixel and its horizontal and vertical neighbours such that if the ratio is exceeded, the center pixel is considered as a white pixel
- Parameters
value (int) –
the white pixel relax value, one of 0, 1, 2, 3.
white pixel relax == 0 : ratio 2;
white pixel relax == 1 : ratio 1.5;
white pixel relax == 2 : ratio 1.25;
white pixel relax == 3 : ratio 1;
- Returns
(0, “”) in case of success; (error_code, error_message) in case of failure
- Return type
(int, str)
- get_white_pixel_relax()¶
Get the current value of the ‘White Pixel Relax’ parameter
- Returns
A tuple (0, white_pixel_relax) if successful; a tuple (error_code, error_message) in case of failure
- Return type
(int, int) | (int, str)
- set_shutter_mode(value)¶
Set the shutter mode
- Parameters
value (int) – one of the values defined in the
ShutterMode
class- Returns
(0, “”) in case of success; (error_code, error_message) in case of failure
- Return type
(int, str)
- get_shutter_mode()¶
Get the currently active shutter mode
- Returns
A tuple (0, shutter_mode) if successful; a tuple (error_code, error_message) in case of failure. The shutter mode value is one of the constants defined in the
ShutterMode
class- Return type
(int, int) | (int, str)