Pixels2d = | harrisCorner2d (inImg,inNbTotPoints,inFeaturesDist) |
Pixels2d = | harrisCorner2d (inImg,inGradStdDev,inNbTotPoints,inFeaturesDist) |
Pixels2d = | harrisCorner2d (inImg,inGradStdDev,inOptGradientGaussianCoverage,inCornerDetectionParams,inNbTotPoints,inThreshold,inFeaturesDistX,inFeaturesDistY) |
Extracts the corners in an image.
This algorithm computes the Harris corner detection on an input image, combining the Harris corner detection 2d image and Local Extrema Extraction 2d algorithms in an efficient way.
For this reason, it is possible to specify parameters for both algorithms :
- InStdDev and InOptGradientGaussianCoverage are the parameters for the Gaussian smoothing in the Harris corner image calculation,
- InCornerDetectionParams is used to compute the Harris corner image,
- InThreshold and InNbTotPoints are the values of the InOptLocalExtremaConfig attribute,
- InFeaturesDistX and InFeaturesDistY are used to extract the corners (i.e. the maxima of the Harris corner detection 2d image result).
Just like Local Extrema Extraction 2d, two wrappers can be called : the harrisCorner2d wrapper is only used to detect the corners on a grey level 2d images, whereas the multiSlice_harrisCorner2d wrapper must be used for more complex data (volume, sequence and/or color).
Here is an example of a 2d Harris corner calculation applied to an 8-bits grey level input image (with
,
,
,
and
). The detected corners are marked as green crosses :
Example of Python code :
Example imports
import PyIPSDK
import PyIPSDK.IPSDKIPLFeatureDetection as fd
Code Example
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
stdDev = 1
gaussRatio = 0.99
halfKnlSize = 5
threshold = 100
nbTotPoints = 1000
sensitivity = 0.04
outPixels2d = fd.harrisCorner2d(inImg, stdDev, PyIPSDK.createGaussianCoverage(gaussRatio, 2), PyIPSDK.createHarrisParams(sensitivity), nbTotPoints, threshold, halfKnlSize, halfKnlSize)
maxPixel2d = PyIPSDK.toPyDict(outPixels2d)['Coll'][0]
print("Corner intensity " + str(maxPixel2d['Intensity'] ) + " found on coordinates x=" + str(maxPixel2d['X'] ) + " and y=" + str(maxPixel2d['Y'] ))
Example of C++ code :
Example informations
Header file
#include <IPSDKIPL/IPSDKIPLFeatureDetection/Processor/HarrisCorner2d/HarrisCorner2d.h>
Code Example
const std::vector< boost::shared_ptr<Pixel2d> > cornerColl = pCornerColl->getNodeColl<Pixels2d::Coll>();
const ipUInt64 nbCorners = cornerColl.size();
PlanIndexedPixels2dPtr pCornerColl_multiSlice = multiSlice_harrisCorner2d(pInImg_multiSlice, stdDev_multiSlice,
createGaussianCoverage(gaussRatio, 2),
createHarrisParams(sensitivity_multiSlice), nbTotPoints, threshold_multiSlice, halfKnlSizeX, halfKnlSizeY);
const std::vector< boost::shared_ptr<Pixel2d> > cornerColl_multiSlice = pCornerColl_multiSlice->getValue(1, 0, 0).getNodeColl<Pixels2d::Coll>();