oakutils.nodes.models package
Submodules
oakutils.nodes.models.gaussian module
Module for creating gaussian models.
Functions
- create_gaussian
Creates a gaussian model with a specified kernel size.
- oakutils.nodes.models.gaussian.create_gaussian(pipeline: dai.Pipeline, input_link: dai.Node.Output, kernel_size: int = 3, shaves: int = 1, *, grayscale_out: bool | None = None) dai.node.NeuralNetwork
Use to create a gaussian model with a specified kernel size.
- Parameters:
pipeline (dai.Pipeline) – The pipeline to add the gaussian to
input_link (dai.node.XLinkOut) – The input link to connect to the gaussian node. Example: cam_rgb.preview.link Explicitly pass in the link as a non-called function.
kernel_size (int, optional) – The size of the gaussian kernel, by default 3 Must be an odd integer Must be between 3 and 15 (since these are the compiled model sizes)
shaves (int, optional) – The number of shaves to use, by default 1 Must be between 1 and 6
grayscale_out (bool, optional) – Whether or not to use graycale output, by default False
- Returns:
The gaussian node
- Return type:
dai.node.NeuralNetwork
oakutils.nodes.models.gftt module
Models for the gftt node.
Functions
- create_gftt
Creates a gftt model as a node.
- oakutils.nodes.models.gftt.create_gftt(pipeline: dai.Pipeline, input_link: dai.Node.Output, blur_kernel_size: int = 3, shaves: int = 1, *, use_blur: bool | None = None, grayscale_out: bool | None = None) dai.node.NeuralNetwork
Use to create a gftt model with a specified kernel size.
- Parameters:
pipeline (dai.Pipeline) – The pipeline to add the gftt to
input_link (dai.node.XLinkOut) – The input link to connect to the gftt node. Example: cam_rgb.preview.link Explicitly pass in the link as a non-called function.
blur_kernel_size (int, optional) – The size of the blur kernel, by default 3 Only used when use_blur is True Must be an odd integer Must be between 3 and 15 (since these are the compiled model sizes)
shaves (int, optional) – The number of shaves to use, by default 1 Must be between 1 and 6
use_blur (bool, optional) – Whether or not to use a blur before the gftt, by default False
grayscale_out (bool, optional) – Whether or not to use graycale output, by default False
- Returns:
The gftt node
- Return type:
dai.node.NeuralNetwork
oakutils.nodes.models.harris module
Models for the harris node.
Functions
- create_harris
Creates a harris model as a node.
- oakutils.nodes.models.harris.create_harris(pipeline: dai.Pipeline, input_link: dai.Node.Output, blur_kernel_size: int = 3, shaves: int = 1, *, use_blur: bool | None = None, grayscale_out: bool | None = None) dai.node.NeuralNetwork
Use to create a harris model with a specified kernel size.
- Parameters:
pipeline (dai.Pipeline) – The pipeline to add the harris to
input_link (dai.node.XLinkOut) – The input link to connect to the harris node. Example: cam_rgb.preview.link Explicitly pass in the link as a non-called function.
blur_kernel_size (int, optional) – The size of the blur kernel, by default 3 Only used when use_blur is True Must be an odd integer Must be between 3 and 15 (since these are the compiled model sizes)
shaves (int, optional) – The number of shaves to use, by default 1 Must be between 1 and 6
use_blur (bool, optional) – Whether or not to use a blur before the harris, by default False
grayscale_out (bool, optional) – Whether or not to use graycale output, by default False
- Returns:
The harris node
- Return type:
dai.node.NeuralNetwork
oakutils.nodes.models.hessian module
Models for the hessian node.
Functions
- create_hessian
Creates a hessian model as a node.
- oakutils.nodes.models.hessian.create_hessian(pipeline: dai.Pipeline, input_link: dai.Node.Output, blur_kernel_size: int = 3, shaves: int = 1, *, use_blur: bool | None = None, grayscale_out: bool | None = None) dai.node.NeuralNetwork
Use to create a hessian model with a specified kernel size.
- Parameters:
pipeline (dai.Pipeline) – The pipeline to add the hessian to
input_link (dai.node.XLinkOut) – The input link to connect to the hessian node. Example: cam_rgb.preview.link Explicitly pass in the link as a non-called function.
blur_kernel_size (int, optional) – The size of the blur kernel, by default 3 Only used when use_blur is True Must be an odd integer Must be between 3 and 15 (since these are the compiled model sizes)
shaves (int, optional) – The number of shaves to use, by default 1 Must be between 1 and 6
use_blur (bool, optional) – Whether or not to use a blur before the hessian, by default False
grayscale_out (bool, optional) – Whether or not to use graycale output, by default False
- Returns:
The hessian node
- Return type:
dai.node.NeuralNetwork
oakutils.nodes.models.laplacian module
Module for creating a laplacian model with a specified kernel size.
Functions
- create_laplacian
Creates a laplacian model with a specified kernel size.
- oakutils.nodes.models.laplacian.create_laplacian(pipeline: dai.Pipeline, input_link: dai.Node.Output, kernel_size: int = 3, blur_kernel_size: int = 3, shaves: int = 1, *, use_blur: bool | None = None, grayscale_out: bool | None = None) dai.node.NeuralNetwork
Use to create a laplacian model with a specified kernel size.
- Parameters:
pipeline (dai.Pipeline) – The pipeline to add the laplacian to
input_link (dai.node.XLinkOut) – The input link to connect to the laplacian node. Example: cam_rgb.preview.link Explicitly pass in the link as a non-called function.
kernel_size (int, optional) – The size of the laplacian kernel, by default 3 Must be an odd integer Must be between 3 and 15 (since these are the compiled model sizes)
blur_kernel_size (int, optional) – The size of the blur kernel, by default 3 Only used when use_blur is True Must be an odd integer Must be between 3 and 15 (since these are the compiled model sizes)
shaves (int, optional) – The number of shaves to use, by default 1 Must be between 1 and 6
use_blur (bool, optional) – Whether or not to use a blur before the laplacian, by default False
grayscale_out (bool, optional) – Whether or not to use graycale output, by default False
- Returns:
The laplacian node
- Return type:
dai.node.NeuralNetwork
oakutils.nodes.models.laserscan module
Models for the laserscan node.
Functions
- create_laserscan
Creates a laserscan model as a node.
- oakutils.nodes.models.laserscan.create_laserscan(pipeline: dai.Pipeline, input_link: dai.Node.Output, width: int = 10, scans: int = 1, shaves: int = 1) dai.node.NeuralNetwork
Use to create a laserscan model with a specified width.
- Parameters:
pipeline (dai.Pipeline) – The pipeline to add the laserscan to
input_link (dai.node.XLinkOut) – The input link to connect to the laserscan node. Example: stereo.depth.link Explicitly pass in the link as a non-called function.
width (int, optional) – The width of the laserscan, by default 10 Options are [5, 10, 20]
scans (int, optional) – The number of scans to use, by default 1 Options are [1, 3, 5] Scans are horizontal lines of depth data, each scan is sampled from a different row of the depth image, with even spacing. A center scan is always generated and is always the middle entry in the output scans.
shaves (int, optional) – The number of shaves to use, by default 1 Must be between 1 and 6
- Returns:
The laserscan node
- Return type:
dai.node.NeuralNetwork
- Raises:
ValueError – If the width is invalid
- oakutils.nodes.models.laserscan.get_laserscan(data: dai.NNData) np.ndarray
Use to get the laserscan data from the output tensor.
- Parameters:
data (dai.NNData) – The data from the output tensor
- Returns:
The laserscan data
- Return type:
np.ndarray
oakutils.nodes.models.point_cloud module
Module for creating a point cloud model onboard.
Functions
- create_xyz_matrix
Use to create a constant reprojection matrix for the given camera matrix and image size.
- create_point_cloud
Use to create a point_cloud model.
- oakutils.nodes.models.point_cloud.create_point_cloud(pipeline: dai.Pipeline, depth_link: dai.Node.Output, calibration: CalibrationData, input_stream_name: str = 'xyz_to_pcl', shaves: int = 4) tuple[dai.node.NeuralNetwork, dai.node.XLinkIn, Callable[[dai.Device], None]]
Use to create a point_cloud model with a specified kernel size.
- Parameters:
pipeline (dai.Pipeline) – The pipeline to add the point_cloud to
depth_link (dai.Node.Output) – The output link of the depth node Example: stereo.depth Explicity pass the object without calling (i.e. not stereo.depth())
calibration (CalibrationData) – The calibration data for the camera
input_stream_name (str, optional) – The name of the input stream, by default “xyz_to_pcl”
shaves (int, optional) – The number of shaves to use, by default 4 Must be between 1 and 6
- Returns:
dai.node.NeuralNetwork – The point_cloud node
dai.node.XLinkIn – The input link to connect to the point_cloud node.
Callable[[dai.Device], None] – Function to pass the device, which will start the point cloud generation
- oakutils.nodes.models.point_cloud.create_xyz_matrix(width: int, height: int, camera_matrix: ndarray) ndarray
Use to create a constant reprojection matrix for the given camera matrix and image size.
Note: This is for generating the input to the point cloud generation model.
- oakutils.nodes.models.point_cloud.get_point_cloud_buffer(data: NNData, frame_size: tuple[int, int] = (640, 400), scale: float = 1000.0, *, remove_zeros: bool | None = None) ndarray
Use to convert the raw data output from a neural network execution and converts it to a point cloud.
- Parameters:
data (dai.NNData) – Raw data output from a neural network execution.
frame_size (tuple[int, int], optional) – The size of the buffer, by default (640, 400) Usually this will be the size of the depth frame. Which inherits its shape from the MonoCamera resolutions.
scale (float, optional) – The scale to apply to the point cloud, by default 1000.0 This will convert from mm to m.
remove_zeros (bool, optional) – Whether to remove zero points, by default None If None, then True is used Recommended to set to True to remove zero points Can speedup reading and filtering of the point cloud by up to 10x
- Returns:
Point cloud buffer
- Return type:
np.ndarray
oakutils.nodes.models.sobel module
Models for the sobel node.
Functions
- create_sobel
Creates a sobel model as a node.
- oakutils.nodes.models.sobel.create_sobel(pipeline: dai.Pipeline, input_link: dai.Node.Output, blur_kernel_size: int = 3, shaves: int = 1, *, use_blur: bool | None = None, grayscale_out: bool | None = None) dai.node.NeuralNetwork
Use to create a sobel model with a specified kernel size.
- Parameters:
pipeline (dai.Pipeline) – The pipeline to add the sobel to
input_link (dai.node.XLinkOut) – The input link to connect to the sobel node. Example: cam_rgb.preview.link Explicitly pass in the link as a non-called function.
blur_kernel_size (int, optional) – The size of the blur kernel, by default 3 Only used when use_blur is True Must be an odd integer Must be between 3 and 15 (since these are the compiled model sizes)
shaves (int, optional) – The number of shaves to use, by default 1 Must be between 1 and 6
use_blur (bool, optional) – Whether or not to use a blur before the sobel, by default False
grayscale_out (bool, optional) – Whether or not to use graycale output, by default False
- Returns:
The sobel node
- Return type:
dai.node.NeuralNetwork
Module contents
Functions for creating models for use in the OAK-D pipeline.
Submodules
- gaussian
Module for creating gaussian models.
- gftt
Module for creating gftt models.
- harris
Module for creating harris models.
- hessian
Module for creating hessian models.
- laplacian
Module for creating laplacian models.
- laserscan
Module for creating laserscan models.
- point_cloud
Module for creating a point cloud model onboard.
- sobel
Module for creating sobel models.
Functions
- create_gaussian
Creates a gaussian model with a specified kernel size.
- create_gftt
Creates a gftt model.
- create_harris
Creates a harris model.
- create_hessian
Creates a hessian model.
- create_laplacian
Creates a laplacian model with a specified kernel size.
- create_laserscan
Creates a laserscan model with a specified width.
- create_point_cloud
Creates a point cloud model onboard.
- create_sobel
Creates a sobel model with a specified kernel size.
- create_xyz_matrix
Use to create a constant reprojection matrix for the given camera matrix and image size.
- get_laserscan
Use to get the laserscan data from the laserscan model.
- get_point_cloud_buffer
Use to get the point cloud buffer from the point cloud model.
- oakutils.nodes.models.create_gaussian(pipeline: dai.Pipeline, input_link: dai.Node.Output, kernel_size: int = 3, shaves: int = 1, *, grayscale_out: bool | None = None) dai.node.NeuralNetwork
Use to create a gaussian model with a specified kernel size.
- Parameters:
pipeline (dai.Pipeline) – The pipeline to add the gaussian to
input_link (dai.node.XLinkOut) – The input link to connect to the gaussian node. Example: cam_rgb.preview.link Explicitly pass in the link as a non-called function.
kernel_size (int, optional) – The size of the gaussian kernel, by default 3 Must be an odd integer Must be between 3 and 15 (since these are the compiled model sizes)
shaves (int, optional) – The number of shaves to use, by default 1 Must be between 1 and 6
grayscale_out (bool, optional) – Whether or not to use graycale output, by default False
- Returns:
The gaussian node
- Return type:
dai.node.NeuralNetwork
- oakutils.nodes.models.create_gftt(pipeline: dai.Pipeline, input_link: dai.Node.Output, blur_kernel_size: int = 3, shaves: int = 1, *, use_blur: bool | None = None, grayscale_out: bool | None = None) dai.node.NeuralNetwork
Use to create a gftt model with a specified kernel size.
- Parameters:
pipeline (dai.Pipeline) – The pipeline to add the gftt to
input_link (dai.node.XLinkOut) – The input link to connect to the gftt node. Example: cam_rgb.preview.link Explicitly pass in the link as a non-called function.
blur_kernel_size (int, optional) – The size of the blur kernel, by default 3 Only used when use_blur is True Must be an odd integer Must be between 3 and 15 (since these are the compiled model sizes)
shaves (int, optional) – The number of shaves to use, by default 1 Must be between 1 and 6
use_blur (bool, optional) – Whether or not to use a blur before the gftt, by default False
grayscale_out (bool, optional) – Whether or not to use graycale output, by default False
- Returns:
The gftt node
- Return type:
dai.node.NeuralNetwork
- oakutils.nodes.models.create_harris(pipeline: dai.Pipeline, input_link: dai.Node.Output, blur_kernel_size: int = 3, shaves: int = 1, *, use_blur: bool | None = None, grayscale_out: bool | None = None) dai.node.NeuralNetwork
Use to create a harris model with a specified kernel size.
- Parameters:
pipeline (dai.Pipeline) – The pipeline to add the harris to
input_link (dai.node.XLinkOut) – The input link to connect to the harris node. Example: cam_rgb.preview.link Explicitly pass in the link as a non-called function.
blur_kernel_size (int, optional) – The size of the blur kernel, by default 3 Only used when use_blur is True Must be an odd integer Must be between 3 and 15 (since these are the compiled model sizes)
shaves (int, optional) – The number of shaves to use, by default 1 Must be between 1 and 6
use_blur (bool, optional) – Whether or not to use a blur before the harris, by default False
grayscale_out (bool, optional) – Whether or not to use graycale output, by default False
- Returns:
The harris node
- Return type:
dai.node.NeuralNetwork
- oakutils.nodes.models.create_hessian(pipeline: dai.Pipeline, input_link: dai.Node.Output, blur_kernel_size: int = 3, shaves: int = 1, *, use_blur: bool | None = None, grayscale_out: bool | None = None) dai.node.NeuralNetwork
Use to create a hessian model with a specified kernel size.
- Parameters:
pipeline (dai.Pipeline) – The pipeline to add the hessian to
input_link (dai.node.XLinkOut) – The input link to connect to the hessian node. Example: cam_rgb.preview.link Explicitly pass in the link as a non-called function.
blur_kernel_size (int, optional) – The size of the blur kernel, by default 3 Only used when use_blur is True Must be an odd integer Must be between 3 and 15 (since these are the compiled model sizes)
shaves (int, optional) – The number of shaves to use, by default 1 Must be between 1 and 6
use_blur (bool, optional) – Whether or not to use a blur before the hessian, by default False
grayscale_out (bool, optional) – Whether or not to use graycale output, by default False
- Returns:
The hessian node
- Return type:
dai.node.NeuralNetwork
- oakutils.nodes.models.create_laplacian(pipeline: dai.Pipeline, input_link: dai.Node.Output, kernel_size: int = 3, blur_kernel_size: int = 3, shaves: int = 1, *, use_blur: bool | None = None, grayscale_out: bool | None = None) dai.node.NeuralNetwork
Use to create a laplacian model with a specified kernel size.
- Parameters:
pipeline (dai.Pipeline) – The pipeline to add the laplacian to
input_link (dai.node.XLinkOut) – The input link to connect to the laplacian node. Example: cam_rgb.preview.link Explicitly pass in the link as a non-called function.
kernel_size (int, optional) – The size of the laplacian kernel, by default 3 Must be an odd integer Must be between 3 and 15 (since these are the compiled model sizes)
blur_kernel_size (int, optional) – The size of the blur kernel, by default 3 Only used when use_blur is True Must be an odd integer Must be between 3 and 15 (since these are the compiled model sizes)
shaves (int, optional) – The number of shaves to use, by default 1 Must be between 1 and 6
use_blur (bool, optional) – Whether or not to use a blur before the laplacian, by default False
grayscale_out (bool, optional) – Whether or not to use graycale output, by default False
- Returns:
The laplacian node
- Return type:
dai.node.NeuralNetwork
- oakutils.nodes.models.create_laserscan(pipeline: dai.Pipeline, input_link: dai.Node.Output, width: int = 10, scans: int = 1, shaves: int = 1) dai.node.NeuralNetwork
Use to create a laserscan model with a specified width.
- Parameters:
pipeline (dai.Pipeline) – The pipeline to add the laserscan to
input_link (dai.node.XLinkOut) – The input link to connect to the laserscan node. Example: stereo.depth.link Explicitly pass in the link as a non-called function.
width (int, optional) – The width of the laserscan, by default 10 Options are [5, 10, 20]
scans (int, optional) – The number of scans to use, by default 1 Options are [1, 3, 5] Scans are horizontal lines of depth data, each scan is sampled from a different row of the depth image, with even spacing. A center scan is always generated and is always the middle entry in the output scans.
shaves (int, optional) – The number of shaves to use, by default 1 Must be between 1 and 6
- Returns:
The laserscan node
- Return type:
dai.node.NeuralNetwork
- Raises:
ValueError – If the width is invalid
- oakutils.nodes.models.create_point_cloud(pipeline: dai.Pipeline, depth_link: dai.Node.Output, calibration: CalibrationData, input_stream_name: str = 'xyz_to_pcl', shaves: int = 4) tuple[dai.node.NeuralNetwork, dai.node.XLinkIn, Callable[[dai.Device], None]]
Use to create a point_cloud model with a specified kernel size.
- Parameters:
pipeline (dai.Pipeline) – The pipeline to add the point_cloud to
depth_link (dai.Node.Output) – The output link of the depth node Example: stereo.depth Explicity pass the object without calling (i.e. not stereo.depth())
calibration (CalibrationData) – The calibration data for the camera
input_stream_name (str, optional) – The name of the input stream, by default “xyz_to_pcl”
shaves (int, optional) – The number of shaves to use, by default 4 Must be between 1 and 6
- Returns:
dai.node.NeuralNetwork – The point_cloud node
dai.node.XLinkIn – The input link to connect to the point_cloud node.
Callable[[dai.Device], None] – Function to pass the device, which will start the point cloud generation
- oakutils.nodes.models.create_sobel(pipeline: dai.Pipeline, input_link: dai.Node.Output, blur_kernel_size: int = 3, shaves: int = 1, *, use_blur: bool | None = None, grayscale_out: bool | None = None) dai.node.NeuralNetwork
Use to create a sobel model with a specified kernel size.
- Parameters:
pipeline (dai.Pipeline) – The pipeline to add the sobel to
input_link (dai.node.XLinkOut) – The input link to connect to the sobel node. Example: cam_rgb.preview.link Explicitly pass in the link as a non-called function.
blur_kernel_size (int, optional) – The size of the blur kernel, by default 3 Only used when use_blur is True Must be an odd integer Must be between 3 and 15 (since these are the compiled model sizes)
shaves (int, optional) – The number of shaves to use, by default 1 Must be between 1 and 6
use_blur (bool, optional) – Whether or not to use a blur before the sobel, by default False
grayscale_out (bool, optional) – Whether or not to use graycale output, by default False
- Returns:
The sobel node
- Return type:
dai.node.NeuralNetwork
- oakutils.nodes.models.create_xyz_matrix(width: int, height: int, camera_matrix: ndarray) ndarray
Use to create a constant reprojection matrix for the given camera matrix and image size.
Note: This is for generating the input to the point cloud generation model.
- oakutils.nodes.models.get_laserscan(data: dai.NNData) np.ndarray
Use to get the laserscan data from the output tensor.
- Parameters:
data (dai.NNData) – The data from the output tensor
- Returns:
The laserscan data
- Return type:
np.ndarray
- oakutils.nodes.models.get_point_cloud_buffer(data: NNData, frame_size: tuple[int, int] = (640, 400), scale: float = 1000.0, *, remove_zeros: bool | None = None) ndarray
Use to convert the raw data output from a neural network execution and converts it to a point cloud.
- Parameters:
data (dai.NNData) – Raw data output from a neural network execution.
frame_size (tuple[int, int], optional) – The size of the buffer, by default (640, 400) Usually this will be the size of the depth frame. Which inherits its shape from the MonoCamera resolutions.
scale (float, optional) – The scale to apply to the point cloud, by default 1000.0 This will convert from mm to m.
remove_zeros (bool, optional) – Whether to remove zero points, by default None If None, then True is used Recommended to set to True to remove zero points Can speedup reading and filtering of the point cloud by up to 10x
- Returns:
Point cloud buffer
- Return type:
np.ndarray