How to place it
Python
C++
Python
Python
1with dai.Pipeline() as pipeline:
2 featureTracker = pipeline.create(dai.node.FeatureTracker)Inputs and Outputs
Usage
Python
C++
Python
Python
1with dai.Pipeline() as pipeline:
2 featureTracker = pipeline.create(dai.node.FeatureTracker)
3
4 # Set number of shaves and number of memory slices to maximum
5 featureTracker.setHardwareResources(2, 2)
6 # Specify to wait until configuration message arrives to inputConfig Input.
7 featureTracker.setWaitForConfigInput(True)
8
9 # You have to use Feature tracker in combination with
10 # an image frame source - mono/color camera or xlinkIn nodeExamples of functionality
How it works
Image cells
target feature count = frame target features / number of cells. The number of cells can be configured in horizontal and in vertical direction. The default number of cells is 4 (horizontal) x 4 (vertical). This means that the default number of target features per cell is: 320 / (4 * 4) = 20. Note that if an already tracked point happens to have its new coordinate in a full cell, it will not be removed, therefore number of features can exceed this limit.Initial Harris Threshold
Entry conditions for new features
- features must not be too close to each other (minimum distance criteria - default value is 50, the unit of measurement being squared euclidean distance in pixels),
- Harris score of the feature is high enough,
- there is enough room in the cell for the feature (target feature count is not achieved).
Harris Threshold for Tracked Features
Feature Maintenance
- have too large tracking error (wasn't tracked correctly),
- have too small Harris score (configurable threshold).
New position calculation
- Using the pyramidal Lucas-Kanade optical flow method.
- Using a dense motion estimation hardware block (Block matcher).
Reference
class
dai::node::FeatureTracker
variable
std::shared_ptr< FeatureTrackerConfig > initialConfig
Initial config to use for feature tracking.
variable
Input inputConfig
Input FeatureTrackerConfig message with ability to modify parameters in runtime. Default queue is non-blocking with size 4.
variable
Input inputImage
Input message with frame data on which feature tracking is performed. Default queue is non-blocking with size 4.
variable
Output outputFeatures
variable
Output passthroughInputImage
Passthrough message on which the calculation was performed. Suitable for when input queue is set to non-blocking behavior.
function
FeatureTracker()function
FeatureTracker(std::unique_ptr< Properties > props)function
void setHardwareResources(int numShaves, int numMemorySlices)Specify allocated hardware resources for feature tracking. 2 shaves/memory slices are required for optical flow, 1 for corner detection only.
Parameters
- numShaves: Number of shaves. Maximum 2.
- numMemorySlices: Number of memory slices. Maximum 2.
inline function
DeviceNodeCRTP()inline function
DeviceNodeCRTP(const std::shared_ptr< Device > & device)inline function
DeviceNodeCRTP(std::unique_ptr< Properties > props)inline function
DeviceNodeCRTP(std::unique_ptr< Properties > props, bool confMode)inline function
DeviceNodeCRTP(const std::shared_ptr< Device > & device, std::unique_ptr< Properties > props, bool confMode)Need assistance?
Head over to Discussion Forum for technical support or any other questions you might have.