IPSDK 0.2
IPSDK : Image Processing Software Development Kit
Harris corner detection 2dSee full documentation
Pixels2dharrisCorner2d (inImg,inNbTotPoints,inFeaturesDist)
Pixels2dharrisCorner2d (inImg,inGradStdDev,inNbTotPoints,inFeaturesDist)
Pixels2dharrisCorner2d (inImg,inGradStdDev,inOptGradientGaussianCoverage,inCornerDetectionParams,inNbTotPoints,inThreshold,inFeaturesDistX,inFeaturesDistY)

Detailed Description

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 :

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 $InStdDev=0.5$, $k = 0.04$, $InFeaturesDistX=InFeaturesDistY=5$, $InThreshold = 750$ and $InNbTotPoints \leq 31$). The detected corners are marked as green crosses :

harrisCorner2d.png

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLFeatureDetection as fd

Code Example

# opening of input image
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# Gaussian gradient and smoothing parameters
stdDev = 1
gaussRatio = 0.99
# half size neighbourhood definition (tchebychev distance)
halfKnlSize = 5
# local maximum parameters definition
threshold = 100
nbTotPoints = 1000
# Algorithm sensitivity definition
sensitivity = 0.04
# Harris corner detection
outPixels2d = fd.harrisCorner2d(inImg, stdDev, PyIPSDK.createGaussianCoverage(gaussRatio, 2), PyIPSDK.createHarrisParams(sensitivity), nbTotPoints, threshold, halfKnlSize, halfKnlSize)
# retrieve coordinates of maximum detected extrema
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

// ------------ Calculation on a mono-slice grey level image ------------ //
// Extrcat the local extrema, in a given neighbourhood
Pixels2dPtr pCornerColl = harrisCorner2d(pInImg, stdDev, createGaussianCoverage(gaussRatio, 2), createHarrisParams(sensitivity), nbTotPoints, threshold, halfKnlSizeX, halfKnlSizeY);
// Retrieve the extrema collection
const std::vector< boost::shared_ptr<Pixel2d> > cornerColl = pCornerColl->getNodeColl<Pixels2d::Coll>();
const ipUInt64 nbCorners = cornerColl.size();
// ------------ Calculation on a multi-slice grey level image ------------ //
// Extrcat the local extrema, in a given neighbourhood
PlanIndexedPixels2dPtr pCornerColl_multiSlice = multiSlice_harrisCorner2d(pInImg_multiSlice, stdDev_multiSlice, createGaussianCoverage(gaussRatio, 2), createHarrisParams(sensitivity_multiSlice), nbTotPoints, threshold_multiSlice, halfKnlSizeX, halfKnlSizeY);
// Retrieve the extrema collection for the frame 0, the channel 0 and the slice 1
const std::vector< boost::shared_ptr<Pixel2d> > cornerColl_multiSlice = pCornerColl_multiSlice->getValue(1, 0, 0).getNodeColl<Pixels2d::Coll>();