LibASICamera API
LibASICamera.allocate_buffer — Methodallocate_buffer(width::Integer, height::Integer, img_type::ASI_IMG_TYPE)Allocates an image buffer for the camera to write to.
Args:
width: Image width
height: Image height
img_type: One of
-ASI_IMG_RAW8
-ASI_IMG_Y8
-ASI_IMG_RAW16
-ASI_IMG_RAW24Returns:
A zero-initialized array of the appropriate shape.Throws:
ASIWrapperError if an unsupported image type is given.LibASICamera.capture_still — Methodcapture_still(id::Integer)Captures a still image. You have to set gain, exposure etc. beforehand using setcontrolvalue(...).
Returns:
An array containing the image.Throws:
ASIWrapperError if the image format is not supported by the wrapper, or
ASIError in other unfortunate casesLibASICamera.close_camera — Methodclose_camera(id::Integer)Closes the ASI camera connection.
Args:
id: Camera idThrows:
ASIErrorLibASICamera.disable_dark_subtract — MethodLibASICamera.enable_dark_subtract — MethodLibASICamera.get_camera_mode — Methodget_camera_mode(id::Integer)Get the current camera mode, only needed to call when the IsTriggerCam in the CameraInfo is true.
LibASICamera.get_camera_property — Methodget_camera_property(id::Integer)Fetches the camera properties for a given ID.
Args:
id: Camera idReturns:
ASI_CAMERA_INFO objectThrows:
ASIError in case of failureLibASICamera.get_connected_devices — Methodget_connected_devices()Returns a list of the connected devices.
LibASICamera.get_control_caps — Methodget_control_caps(id::Integer)Returns the control properties available for this camera.
The camera needs to be open.
Args:
id: Camera idReturns:
Vector of ASI_CONTROL_CAPS structs.Throws:
ASIErrorLibASICamera.get_control_value — Methodget_control_value(id::Integer, control_type::ASI_CONTROL_TYPE)Fetches the current setting of the control value, e.g. exposure or gain.
Args:
id: Camera id
control_type: The control type to fetch, e.g. exposure or gain.Returns:
A tuple (value, is_auto)Throws:
ASIErrorLibASICamera.get_data_after_exp! — Methodget_data_after_exp!(id::Integer, buffer)Fetches the data after a successful exposure and writes it into buffer.
LibASICamera.get_dropped_frames — Methodget_dropped_frames(id::Integer)Returns the number of dropped frames.
Frames are dropped when the USB is bandwidth is low or the harddisk write speed is slow. The count is reset to 0 after capturing stops.
LibASICamera.get_exp_status — Methodget_exp_status(id::Integer)Returns the status of an ongoing exposure. See 'instances(ASIEXPSTATUS)'.
Throws:
ASIErrorLibASICamera.get_gain_offset — Methodget_gain_offset(id::Integer)Get the presets for offset and gain values at different "sweet spots".
Args:
id: Camera idReturns:
A dictionary containing:
1. The offset at highest dynamic range
2. The offset at unity gain
3. The gain with lowest readout noise
4. The offset with lowest readout noiseThrows:
ASIErrorLibASICamera.get_id — Methodget_id(id::Integer)Returns the camera id stored in flash, only available for USB3 cameras.
LibASICamera.get_num_connected_cameras — Methodget_num_connected_cameras()This function returns the count of connected cameras and should be called first.
LibASICamera.get_roi_format — Methodget_roi_format(id::Integer)Fetches the current region of interest settings.
LibASICamera.get_roi_start — Methodget_roi_start(id::Integer)Returns the region of interest start position (startx, starty).
LibASICamera.get_sdk_version — Methodget_sdk_version()Returns the SDK version.
LibASICamera.get_serial_number — Methodget_serial_number(id::Integer)Returns the camera serial number.
LibASICamera.get_status — Methodget_status(id::Integer)Returns the status of all camera parameters.
LibASICamera.get_supported_modes — Methodget_supported_modes(id::Integer)Returns the supported camera modes, only need to call when the IsTriggerCam in the CameraInfo is true.
Throws:
ASIErrorLibASICamera.get_trigger_output_config — Methodget_trigger_output_config(id::Integer)Get the output pin configuration, only needed to call when the IsTriggerCam in the CameraInfo is true.
LibASICamera.get_video_data! — Functionget_video_data!(id::Integer, buffer, timeout_ms)Writes a video frame to the given buffer. Make sure the buffer is large enough to fit the frame. Call this as fast as possible in a loop and check whether the return value equals ASI_SUCCESS.
Args:
id: Camera id
buffer: A buffer to write the video frame to.
timeout_ms: Time to wait for a frame. Recommendation: 2 * exposure_μs + 500 ms <- inconsistent units?!Returns:
An ASI_ERROR_CODE, which should be ASI_SUCCESS.LibASICamera.init_camera — Methodinit_camera(id::Integer)Initialize the camera. Needs to be called before capturing any data.
Args:
id: Camera idThrows:
ASIErrorLibASICamera.open_camera — Methodopen_camera(id::Integer)Opens the ASI camera connection.
Open the camera before any interaction with the camera, this will not affect the camera which is capturing. Then you must call init_camera() to perform any actions.
Args:
id: Camera IDThrows:
ASIErrorLibASICamera.pulse_guide_off — Methodpulse_guide_off(id::Integer, direction::ASI_GUIDE_DIRECTION)Deactivates the pulse guide in the given direction.
Args:
id: Camera id
direction: Guiding direction; call 'instances(ASI_GUIDE_DIRECTION)' for options.Throws:
ASIErrorLibASICamera.pulse_guide_on — Methodpulse_guide_on(id::Integer, direction::ASI_GUIDE_DIRECTION)Activates the pulse guide in the given direction.
Args:
id: Camera id
direction: Guiding direction; call 'instances(ASI_GUIDE_DIRECTION)'Throws:
ASIErrorLibASICamera.send_soft_trigger — Methodsend_soft_trigger(id::Integer, start::ASI_BOOL)From original docs: Send a softTrigger. For edge trigger, it only need to set true which means send a rising trigger to start exposure. For level trigger, it need to set true first means start exposure, and set false means stop exposure. Only needed to call when the IsTriggerCam in the CameraInfo is true.
LibASICamera.set_camera_mode — Methodset_camera_mode(id::Integer, mode::ASI_CAMERA_MODE)Set the camera mode, only needed to call when the IsTriggerCam in the CameraInfo is true.
LibASICamera.set_control_value — Functionset_control_value(id::Integer, control_type::ASI_CONTROL_TYPE, value, auto::Bool=false)Sets a control (e.g. exposure) to the given value. Automatically sets the minimum or maximum if the given value is out of bounds.
Args:
id: Camera id
control_type: The control type to set, e.g. exposure or gain.
value: The value to which the control is set.
auto: Whether or not the control should be automatically set.
Check if this is supported for the given control beforehand.Throws:
ASIErrorLibASICamera.set_roi_format — Methodset_roi_format(id::Integer, width, height, binning, img_type::ASI_IMG_TYPE)Sets the region of interest (roi). Do so before capturing.
The width and height are the values after binning, i.e. you need to set the width to 640 and the height to 480 if you want to run at 640x480 @ BIN2.
ASI120's data size must be a multiple of 1024 which means width*height%1024==0.
Args:
id: Camera id
width: ROI width
height: ROI height
binning: The binning mode; 2 means to read out 2x2 pixels together. Check
which binning values are supported in the ASI_CAMERA_INFO struct of the
camera struct or by calling get_camera_property(id).Throws:
ASIErrorLibASICamera.set_roi_start — Methodset_roi_start(id::Integer, startx, starty)Sets the position of the top-left corner of the region of interest.
You can call this while the camera is streaming to move the ROI. By default, the ROI will be centered. In binned mode, the start values are relative to the binned sensor size.
Throws:
ASIErrorLibASICamera.set_trigger_output_config — Methodset_trigger_output_config(id::Integer, pin::ASI_TRIG_OUTPUT_PIN, high::ASI_BOOL, delay, duration)Configure the output pin (A or B) of Trigger port. If duration <= 0, this output pin will be closed. Only need to call when the IsTriggerCam in the CameraInfo is true.
Args:
id: Camera id
pin: Select the pin for output
high: If true, the selected pin will output a high level as a signal
when it is effective.
delay: The delay between the camera receiving a trigger signal and the
output of the valid level. From 0 μs - 2,000,000,000 μs.
duration: The duration of the valid level output. Same range as delay.LibASICamera.start_exposure — Functionstart_exposure(id::Integer, is_dark=false)Starts an exposure. All relevant parameters (exposure time, gain) have to be set beforehand by calling setcontrolvalue(...) or e.g. set_gain(...).
LibASICamera.start_video — Methodstart_video(id::Integer)Start video capture.
Throws:
ASIErrorLibASICamera.stop_exposure — Methodstop_exposure(id::Integer)Stops an ongoing exposure.
LibASICamera.stop_video — Methodstop_video(id::Integer)Stops a running video capture.
Throws:
ASIErrorLibASICamera.ASICamera — TypeASICameraThe struct which contains information about the camera. Has fields .info and .control_caps.