Get in touch with us today and our team of imaging professionals will be pleased to assist you.
This topic describes the Task class and the derived task type classes in the eSDK Pro API:
Task class — Base class representing a unit of work in a processing pipeline.CameraTask class — Acquires image frames from a camera device.FrameGenTask class — Generates synthetic test frames instead of using a camera.PluginTask class — Runs custom user-defined processing code inside the pipeline.NvencTask class — Encodes incoming frames into a video file using NVIDIA GPU acceleration.RawSavingTask class — Saves uncompressed image frames to disk as raw files.ImageDisplayTask class — Displays downsampled preview frames for on-screen viewing.
Task ClassNamespace: eSdkPro Header: eSdkPro/task.h
The basic unit of work when processing data. Conceptually, a task receives input data, processes the data, and produces output data. When running, a task uses a dedicated processing thread to process incoming data. Tasks are connected to one another via uniquely identified Ports, through which data is sent.
Each task represents the frontend interface to a backend task worker, which provides the implementation for processing data. In an eSDK Pro application, the task worker is typically not directly accessible, so configuration is done through the associated task object instead. A custom task worker may be implemented using our plugin API and loaded as a PluginTask. We provide derived classes for each type of task.
SetLabel()void eSdkPro::Task::SetLabel (const std::string& label)
Sets the optional unique label of the task for identification.
Parameter: label — The label of the task.
GetLabel()std::string eSdkPro::Task::GetLabel () const
Gets the unique label of the task.
Returns: The task's label.
SetCpuCore()void eSdkPro::Task::SetCpuCore (int cpuCore)
Sets the CPU core for the task’s processing thread — if not specified, using default 0.
Parameter: cpuCore — The CPU core number to pin the thread to.
GetCpuCore()int eSdkPro::Task::GetCpuCore () const
Returns: The CPU core used by this task.
SetGpuDeviceId()void eSdkPro::Task::SetGpuDeviceId (const int gpuDeviceId)
Sets the GPU device id to use for this task.
Parameter: gpuDeviceId — The index of the GPU device.
GetGpuDeviceId()int eSdkPro::Task::GetGpuDeviceId () const
Returns: The GPU device id used by this task.
GetParameter()template<typename T, typename = ValidTaskParam<T>>
T eSdkPro::Task::GetParameter (const std::string& name) const
Gets a task parameter of type T.
Template parameter: T — The type of the task parameter. T must derive from TaskParam.
Parameter: name — The parameter name.
Returns: The task parameter of type T.
CameraTask ClassNamespace: eSdkPro Header: eSdkPro/task.h
Task for using a camera within a pipeline.
GetOutput()Output eSdkPro::CameraTask::GetOutput () const
Returns: The output frame port.
FrameGenTask ClassNamespace: eSdkPro Header: eSdkPro/task.h
Task for generating test frames.
Struct: eSdkPro::FrameGenTask::InitParams
Initialization parameters for frame generation.
Members
m_width — The frame output width.m_height — The frame output height.m_pixelFormat — The frame pixel format.m_framerate — The target frame rate for frames to be generated.m_colourHex — The frame colour in hex (without #), e.g. “FF0000” for red or “00FF00” for green.m_fadingStep — A value 0–255 controlling a fade effect. Brightness decreases by this value each frame; out-of-range values are ignored and 0 is used.
PixelFormat EnumDefines the pixel formats for frame generation.
BayerRG8Mono8RGB8BGR8
GetOutput()Output eSdkPro::FrameGenTask::GetOutput () const
Returns: The output frame port.
PluginTask ClassNamespace: eSdkPro Header: eSdkPro/task.h
Task for running custom code within a pipeline.
GetInput()Input eSdkPro::PluginTask::GetInput (const std::string& name) const
Parameter: name — The name of an input port.
Returns: The input port.
GetOutput()Output eSdkPro::PluginTask::GetOutput (const std::string& name) const
Parameter: name — The name of an output port.
Returns: The output port.
NvencTask ClassNamespace: eSdkPro Header: eSdkPro/task.h
Task for compressing frames into a video file.
Struct: eSdkPro::NvencTask::InitParams
Initialization parameters for video encoding.
Members
m_gpuDeviceId — The GPU ID to use for encoding.m_baseRecordingPath — The base path for encoded-video output; subdirectories are created automatically.m_width — The input image width.m_height — The input image height.m_pixelFormat — The pixel format of the input image.m_framerate — The output frame rate of the encoded video.m_codecType — The codec type used for encoding.m_bitrateKbps — The target output bitrate in kilobits per second.
CodecType EnumDefines the codec types supported for video encoding.
H264_AVCH265_HEVC
GetInput()Input eSdkPro::NvencTask::GetInput () const
Returns: The input port.
GetOutput()Output eSdkPro::NvencTask::GetOutput () const
Returns: The output encoded video port.
GetLastRecordingPath()std::string eSdkPro::NvencTask::GetLastRecordingPath () const
Returns: The recording path of the last completed recording using this task.
RawSavingTask ClassNamespace: eSdkPro Header: eSdkPro/task.h
Task for saving raw images to disk.
GetInput()Input eSdkPro::RawSavingTask::GetInput () const
Returns: The input frame port.
SetMultiRecordingPaths()void eSdkPro::RawSavingTask::SetMultiRecordingPaths (const std::vector<std::string>& baseRecordingPaths)
Sets base paths for multi-path recording. Records data to multiple paths in a round-robin fashion. Directories may be on different drives for higher bandwidth recording. Supports up to 4 different paths. Files across all directories will be linked to a directory in the first base recording path.
Parameter: baseRecordingPaths — The list of recording paths.
SetDirectIO()void eSdkPro::RawSavingTask::SetDirectIO (bool directIO)
Enables DirectIO for highest performance raw saving. Requires the image datasize to be aligned to 512 bytes. This options is enabled by default.
Parameter: directIO — True = enabled; False = disabled.
GetLastRecordingPath()std::string eSdkPro::RawSavingTask::GetLastRecordingPath () const
Returns: The recording path of the last completed recording using this task.
ImageDisplayTask ClassNamespace: eSdkPro Header: eSdkPro/task.h
Task receiving downsampled preview frames. Image quality may be controlled using System::SetPreviewQuality().
GetInput()Input eSdkPro::ImageDisplayTask::GetInput () const
Returns: The input frame port.
Get in touch with us today and our team of imaging professionals will be pleased to assist you.