API Reference#
pyDCAM.dcamapi module#
- class pyDCAM.dcamapi.HDCAM(index=0)[source]#
Bases:
objectCamera handle.
It’s recommended to use with statement to ensure the camera is closed properly.
- Parameters:
index (int, optional) – The index of the camera to open. Defaults to 0.
Examples
>>> with HDCAM() as hdcam: >>> print(hdcam.model) >>> print(hdcam.camera_id)
- property bus: str#
- property camera_id: str#
The camera ID.
- dcambuf_alloc(framecount=64)[source]#
Allocates internal image buffers for image acquisition.
This function does not start the capture. To start capture, dcamcap_start() should be called.
When the internal buffers are no longer necessary, call dcambuf_release() to release them.
- Parameters:
framecount (int, optional) – The number of frames to allocate. Defaults to 64.
- dcambuf_copyframe(iFrame=-1) ndarray[source]#
Returns a NumPy array containing the captured image copied from the buffer.
- Parameters:
iFrame (int, optional) – The frame index. Defaults to -1, which retrieves the latest captured image.
- Returns:
img – The captured image buffer.
- Return type:
np.ndarray
- dcambuf_lockframe(iFrame=-1) ndarray[source]#
Returns a NumPy array pointing to the captured image buffer.
If the host software dcambuf_copyframe needs to copy the image data into its own memory, use dcambuf_copyframe() instead of this function.
- Parameters:
iFrame (int, optional) – The frame index. Defaults to -1, which retrieves the latest captured image.
- Returns:
img – The captured image buffer.
- Return type:
np.ndarray
See also
HDCAM.dcambuf_copyframeThe function that copied the captured image buffer instead of pointing to it.
- dcamcap_firetrigger()[source]#
Fire a software trigger.
This is only effective if the software trigger mode.
- dcamcap_start(mode=DCAMCAP_START.DCAMCAP_START_SEQUENCE)[source]#
start capturing images.
Before calling this function, a capturing buffer should be prepared.
- Parameters:
mode (DCAMCAP_START, optional) – The capture mode. Defaults to DCAMCAP_START_SEQUENCE. With the DCAMCAP_START_SEQUENCE mode, capturing will be continuing until the dcamcap_stop() function is called. With the DCAMCAP_START_SNAP mode, capturing is terminated when the capturing buffer is filled or until the dcamcap_stop() function is called.
See also
HDCAM.dcamcap_stopStop capturing images.
HDCAM.dcambuf_allocAllocate internal image buffers for image acquisition.
- dcamcap_stop()[source]#
Stop capturing images.
See also
HDCAM.dcamcap_startStart capturing images.
- dcamcap_transferinfo() Tuple[int, int][source]#
Get the transfer information.
- Returns:
nNewestFrameIndex (int) – The index of the newest frame of the transferred image.
nFrameCount (int) – The number of iamges has been transferred.
- dcamdev_getstring(iString: DCAM_IDSTR) str[source]#
Get the string of the camera.
- Parameters:
iString (DCAM_IDSTR) – The string to get.
- dcamprop_getattr(iProp: DCAMPROPMODEVALUE)[source]#
- dcamprop_getname(iProp: DCAMIDPROP) str[source]#
Get the name of the property.
- Parameters:
iProp (DCAMIDPROP) – The property ID.
- Returns:
The name of the property.
- Return type:
str
- dcamprop_getvalue(iProp: DCAMIDPROP) float[source]#
Get the value of the property.
- Parameters:
iProp (DCAMIDPROP) – The property ID.
- Returns:
The value of the property.
- Return type:
float
- dcamprop_ids(option: DCAMPROPOPTION = DCAMPROPOPTION.DCAMPROP_OPTION_SUPPORT) DCAMIDPROP[source]#
Generator for enumerating the property IDs.
- Parameters:
option (DCAMPROPOPTION, optional) – Defaults to the properties supported by the device.
- Yields:
iProp (DCAMIDPROP) – The property ID.
Examples
>>> with HDCAM() as hdcam: >>> for iProp in hdcam.dcamprop_ids(): >>> print(hdcam.dcamprop_getname(iProp))
- dcamprop_setgetvalue(iProp: DCAMIDPROP, fValue: float) float[source]#
Set the value of the property and get the accurate value if successful.
- Parameters:
iProp (DCAMIDPROP) – The property ID.
- Returns:
The value of the property.
- Return type:
float
- Raises:
DCAMError – If the device does not support a property. An error with code DCAMERR_NOTSUPPORT is raised. If a property does not have auto-rounding and the fValue is not a valid value, an error with code DCAMERR_INVALIDPARAM is raised.
- dcamprop_setvalue(iProp: DCAMIDPROP, fValue)[source]#
Set the value of the property.
- Parameters:
iProp (DCAMIDPROP) – The property ID.
- Raises:
DCAMError – If the device does not support a property. An error with code DCAMERR_NOTSUPPORT is raised. If a property does not have auto-rounding and the fValue is not a valid value, an error with code DCAMERR_INVALIDPARAM is raised.
- dcamwait_open() HDCAMWAIT[source]#
Open a wait handle for the camera.
See also
HDCAMWAIT.dcamwait_closeClose the wait handle.
- property exposure_time: float#
- property model: str#
The camera model.
- property readout_speed: DCAMPROPMODEVALUE#
- property subarray_mode: bool#
The subarray mode. True for on, False for off.
- property subarray_pos: Tuple[int, int]#
The subarray position in (x, y)
- property subarray_size: Tuple[int, int]#
The subarray size in (width, height)
- class pyDCAM.dcamapi.HDCAMWAIT(hwait, supportevent)[source]#
Bases:
objectWait handle for the camera. It is used to block the program and wait for a specific event.
Instead of instantiating this class directly, use HDCAM.dcamwait_open() to open a wait handle.
See also
HDCAM.dcamwait_openOpen a wait handle for the camera.
- dcamwait_start(eventmask=DCAMWAIT_EVENT.DCAMWAIT_CAPEVENT_FRAMEREADY, timeout=DCAMWAIT_TIMEOUT.DCAMWAIT_TIMEOUT_INFINITE)[source]#
Start waiting for a specific event.
- Parameters:
eventmask (DCAMWAIT_EVENT, optional) – The event to wait for. Defaults to waiting for the next frame ready event.
timeout (int, optional) – The timeout in milliseconds. Defaults to no timeout.