mecheye.area_scan_3d_camera.Camera¶
- class mecheye.area_scan_3d_camera.Camera(*args)¶
Camera connection, SDK operations, and NumPy capture conveniences.
Camera()requires explicit connect().Camera(ip)remembers an IP and connects on context entry or first convenience capture/configuration.Camera(other_camera)shares the native connection and callback registry. Construction does not connect. Use a context manager or disconnect() to release a connection; close() is the same operation.SDK methods return ErrorStatus and never retry implicitly. Convenience methods raise the MechEyeError subclasses from mecheye.shared on failure. SDK access is serialized across camera instances; user code must synchronize writes to returned NumPy arrays and to its own callback state.
- static discover_cameras(timeoutMs=5000)¶
Discover cameras on reachable interfaces without connecting.
- Parameters:
timeoutMs – Discovery timeout in milliseconds.
- Returns:
A VectorCameraInfo containing discovered device information.
- connect(*args)¶
Connect using an IP address or CameraInfo and an optional timeout.
Accepted forms are
connect(ip)andconnect(info), with an optional second positionaltimeoutMsargument (default 5000 milliseconds). The IP is remembered after a successful connection. No retries are performed.- Returns:
ErrorStatus; inspect is_ok() before using the connection.
- disconnect()¶
Disconnect and stop this connection’s callback registrations.
Camera copies share the connection, so disconnecting one also affects the others. This method can be called repeatedly.
- Returns:
None.
- close()¶
Disconnect and stop this connection’s callback registrations.
Camera copies share the connection, so disconnecting one also affects the others. This method can be called repeatedly.
- Returns:
None.
- property connected¶
Whether the shared native camera connection is currently active.
- property ip¶
The optional or last successfully connected IP address, or None.
- property device_info¶
Read device metadata into a new Python dictionary.
Includes model, device name, serial number, SDK and firmware versions, IP address, subnet mask, assignment method, port, and support information.
- Raises:
mecheye.shared.MechEyeConnectionError – The SDK cannot read the device information.
- property camera_parameters¶
Read camera matrices, distortion coefficients, and depth-to-texture transform.
The returned dictionary contains
depthandtexturedictionaries with flat 3-by-3intrinsic_matrixvalues and five distortion coefficients.T_texture_camera_depth_camera_matrix_mmis a 4-by-4 nested list.- Raises:
mecheye.shared.MechEyeConnectionError – The SDK cannot read the intrinsics.
- configure_depth_source_2d_exposure(mode)¶
Set and verify the depth-source 2D exposure mode.
- Parameters:
mode – Either
"timed"or"flash".- Returns:
The requested mode after successful device readback.
- Raises:
ValueError – The mode is not supported.
mecheye.shared.MechEyeConnectionError – The camera cannot be connected.
mecheye.shared.MechEyeConfigurationError – Configuration or readback fails.
- capture_points(timeoutMs=10000)¶
Capture aligned grayscale and organized XYZ arrays in millimeters.
Uses depth-source 2D and 3D capture, camera intrinsics, and SDK mapping. The camera model must support depth-source 2D capture. An optional constructor IP enables lazy connection; SDK capture errors are not retried.
- Parameters:
timeoutMs – Capture timeout in milliseconds.
- Returns:
(image, points)with owned NumPy buffers.imagehas shape(height, width)and dtypeuint8;pointshas shape(height, width, 3)and dtypefloat64. All-zero SDK points become NaN triplets; non-finite coordinate components become NaN.- Raises:
mecheye.shared.MechEyeConnectionError – Connection is unavailable.
mecheye.shared.MechEyeCaptureError – Capture, frame validation, or intrinsics fail.
mecheye.shared.MechEyePointCloudError – Mapping fails or produces an invalid grid.
mecheye.shared.MechEyeConfigurationError – Restoring the previous cloud unit fails.
The previous cloud unit is restored after capture or mapping succeeds or fails. If restoration itself fails, that configuration error is raised.
- pop_callback_errors()¶
Return and clear pending callback exceptions in registration context order.
Camera copies share the error queue. Exceptions are retained without printing. :return: A new list of exceptions.
- set_heartbeat_interval(timeIntervalMs)¶
Set the SDK heartbeat interval in milliseconds; return ErrorStatus.
- get_camera_info(info)¶
Fill the supplied CameraInfo with device metadata; return ErrorStatus.
- get_camera_status(status)¶
Fill the supplied CameraStatus with temperatures; return ErrorStatus.
- get_camera_resolutions(resolutions)¶
Fill the supplied CameraResolutions with image sizes; return ErrorStatus.
- current_user_set()¶
Return a handle to the current device UserSet.
Read and write operations on the handle report SDK status values. Obtain a new handle after reconnecting or changing the selected configuration.
- user_set_manager()¶
Return the connection’s UserSetManager for selecting and persisting user sets.
- capture_3d(frame3D, timeoutMs=5000)¶
Capture a 3D frame into the supplied output container.
timeoutMsis measured in milliseconds. The camera must already be connected; this SDK operation does not initiate a connection or retry a failure. :return: ErrorStatus; only read output data after is_ok() succeeds.
- capture_3d_with_normal(frame3D, timeoutMs=10000)¶
Capture a 3D frame with normals into the supplied output container.
timeoutMsis measured in milliseconds. The camera must already be connected; this SDK operation does not initiate a connection or retry a failure. :return: ErrorStatus; only read output data after is_ok() succeeds.
- capture_2d(frame2D, timeoutMs=5000)¶
Capture a 2D frame into the supplied output container.
timeoutMsis measured in milliseconds. The camera must already be connected; this SDK operation does not initiate a connection or retry a failure. :return: ErrorStatus; only read output data after is_ok() succeeds.
- capture_depth_source_2d(frame2D, timeoutMs=5000)¶
Capture the depth-source 2D frame into the supplied output container.
timeoutMsis measured in milliseconds. The camera must already be connected; this SDK operation does not initiate a connection or retry a failure. :return: ErrorStatus; only read output data after is_ok() succeeds.
- capture_2d_and_3d(frame2DAnd3D, timeoutMs=10000)¶
Capture a combined texture 2D and 3D frame into the supplied output container.
timeoutMsis measured in milliseconds. The camera must already be connected; this SDK operation does not initiate a connection or retry a failure. :return: ErrorStatus; only read output data after is_ok() succeeds.
- capture_depth_source_2d_and_3d(frame2DAnd3D, timeoutMs=10000)¶
Capture a combined depth-source 2D and 3D frame into the supplied output container.
timeoutMsis measured in milliseconds. The camera must already be connected; this SDK operation does not initiate a connection or retry a failure. :return: ErrorStatus; only read output data after is_ok() succeeds.
- capture_2d_and_3d_with_normal(frame2DAnd3D, timeoutMs=15000)¶
Capture a combined 2D and 3D frame with normals into the supplied output container.
timeoutMsis measured in milliseconds. The camera must already be connected; this SDK operation does not initiate a connection or retry a failure. :return: ErrorStatus; only read output data after is_ok() succeeds.
- capture_stereo_2d(left, right, isRectified=False, timeoutMs=5000)¶
Capture left and right stereo 2D frames into the supplied output container.
timeoutMsis measured in milliseconds. The camera must already be connected; this SDK operation does not initiate a connection or retry a failure. :return: ErrorStatus; only read output data after is_ok() succeeds. :param isRectified: Whether the SDK should rectify the stereo images.
- set_point_cloud_unit(unit)¶
Set CoordinateUnit_Millimeter or CoordinateUnit_Meter; return ErrorStatus.
- save_virtual_device_file(fileName)¶
Save a virtual-device file at fileName through the SDK; return ErrorStatus.
- get_camera_intrinsics(wrappedIntrinsics)¶
Fill the supplied CameraIntrinsics with calibration values; return ErrorStatus.
- get_point_cloud_unit()¶
Return
[status, unit]for the SDK’s current CoordinateUnit selection.