IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit

Extracts the corners in an image. More...

IPSDKIPLFEATUREDETECTION_API ipsdk::imaproc::attr::Pixels2dPtr ipsdk::imaproc::fd::harrisCorner2d (const ipsdk::image::ImageConstPtr &pInImg, const ipsdk::ipUInt64 inNbTotPoints, const ipsdk::ipUInt32 inFeaturesDist)
 wrapper function for Extracts the corners in an image More...
 
IPSDKIPLFEATUREDETECTION_API ipsdk::imaproc::attr::Pixels2dPtr ipsdk::imaproc::fd::harrisCorner2d (const ipsdk::image::ImageConstPtr &pInImg, const ipsdk::ipReal32 inGradStdDev, const ipsdk::ipUInt64 inNbTotPoints, const ipsdk::ipUInt32 inFeaturesDist)
 wrapper function for Extracts the corners in an image More...
 
IPSDKIPLFEATUREDETECTION_API ipsdk::imaproc::attr::Pixels2dPtr ipsdk::imaproc::fd::harrisCorner2d (const ipsdk::image::ImageConstPtr &pInImg, const ipsdk::ipReal32 inGradStdDev, const attr::GaussianCoverageConstPtr &pInOptGradientGaussianCoverage, const ipsdk::imaproc::attr::CornerDetectionParamsConstPtr &pInCornerDetectionParams, const ipsdk::ipUInt64 inNbTotPoints, const ipsdk::ipReal64 inThreshold, const ipsdk::ipUInt32 inFeaturesDistX, const ipsdk::ipUInt32 inFeaturesDistY)
 wrapper function for Extracts the corners in an image More...
 
IPSDKIPLFEATUREDETECTION_API ipsdk::imaproc::attr::PlanIndexedPixels2dPtr ipsdk::imaproc::fd::multiSlice_harrisCorner2d (const ipsdk::image::ImageConstPtr &pInImg, const ipsdk::ipUInt64 inNbTotPoints, const ipsdk::ipUInt32 inFeaturesDist)
 multi slices version of wrapper function for extracts the corners in an image. This wrapper can be used with multi slice input images More...
 
IPSDKIPLFEATUREDETECTION_API ipsdk::imaproc::attr::PlanIndexedPixels2dPtr ipsdk::imaproc::fd::multiSlice_harrisCorner2d (const ipsdk::image::ImageConstPtr &pInImg, const ipsdk::ipReal32 inGradStdDev, const ipsdk::ipUInt64 inNbTotPoints, const ipsdk::ipUInt32 inFeaturesDist)
 multi slices version of wrapper function for extracts the corners in an image. This wrapper can be used with multi slice input images More...
 
IPSDKIPLFEATUREDETECTION_API ipsdk::imaproc::attr::PlanIndexedPixels2dPtr ipsdk::imaproc::fd::multiSlice_harrisCorner2d (const ipsdk::image::ImageConstPtr &pInImg, const ipsdk::ipReal32 inGradStdDev, const attr::GaussianCoverageConstPtr &pInOptGradientGaussianCoverage, const ipsdk::imaproc::attr::CornerDetectionParamsConstPtr &pInCornerDetectionParams, const ipsdk::ipUInt64 inNbTotPoints, const ipsdk::ipReal64 inThreshold, const ipsdk::ipUInt32 inFeaturesDistX, const ipsdk::ipUInt32 inFeaturesDistY)
 multi slices version of wrapper function for extracts the corners in an image. This wrapper can be used with multi slice input images More...
 

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

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InImg [Input] image for processing operation X
ipsdk::imaproc::attr::InOptGradStdDev [Input Optional] standard deviation used for gradient computation X
ipsdk::imaproc::attr::InOptGradientGaussianCoverage [Input Optional] Parameter allowing to specify a gaussian distribution coverage for processing X
ipsdk::imaproc::attr::InOptCornerDetectionParams2d [Input Optional] parameters used during corner detection process X
ipsdk::imaproc::attr::InLocalExtremaConfig [Input] Attribute for local extrema calculation configuration X
ipsdk::imaproc::attr::InFeaturesDistX [Input] distance between detected features along x axis (tchebychev distance) X
ipsdk::imaproc::attr::InFeaturesDistY [Input] distance between detected features along y axis (tchebychev distance) X
ipsdk::imaproc::attr::OutWk1Img [Output] Temporary working image for algorithm promoteUnary (_pOutWk1Img, _pInImg, ipsdk::imaproc::ePromoteUnaryType::ePUT_UpperSigned)
ipsdk::imaproc::attr::OutWk2Img [Output] Temporary working image for algorithm promoteUnary (_pOutWk2Img, _pInImg, ipsdk::imaproc::ePromoteUnaryType::ePUT_UpperSigned)
ipsdk::imaproc::attr::OutWk3Img [Output] Temporary working image for algorithm promoteUnary (_pOutWk3Img, _pInImg, ipsdk::imaproc::ePromoteUnaryType::ePUT_UpperSigned)
ipsdk::imaproc::attr::OutPIPixels2d [Output] plan indexed collection of positions and intensities of 2d pixels ipsdk::imaproc::fromImage (_pOutPIPixels2d, _pInImg)

Global Rule description

Global rule description for algorithm :
ipsdk::imaproc::matchImagePlans (_pOutPIPixels2d,_pInImg,eImagePlansMatchPolicy::eIPMP_ZCT) && 
ipsdk::imaproc::matchSize (_pInImg,_pOutWk1Img) && 
ipsdk::imaproc::matchSizeAndType (_pOutWk1Img,_pOutWk2Img,_pOutWk3Img)

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

Associated library

IPSDKIPLFeatureDetection

Header file

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>();
See also
HarrisCorner2dLvl1
HarrisCorner2dLvl2

Function Documentation

◆ harrisCorner2d() [1/3]

IPSDKIPLFEATUREDETECTION_API ipsdk::imaproc::attr::Pixels2dPtr ipsdk::imaproc::fd::harrisCorner2d ( const ipsdk::image::ImageConstPtr pInImg,
const ipsdk::ipUInt64  inNbTotPoints,
const ipsdk::ipUInt32  inFeaturesDist 
)

wrapper function for Extracts the corners in an image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ multiSlice_harrisCorner2d() [1/3]

IPSDKIPLFEATUREDETECTION_API ipsdk::imaproc::attr::PlanIndexedPixels2dPtr ipsdk::imaproc::fd::multiSlice_harrisCorner2d ( const ipsdk::image::ImageConstPtr pInImg,
const ipsdk::ipUInt64  inNbTotPoints,
const ipsdk::ipUInt32  inFeaturesDist 
)

multi slices version of wrapper function for extracts the corners in an image. This wrapper can be used with multi slice input images

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ harrisCorner2d() [2/3]

IPSDKIPLFEATUREDETECTION_API ipsdk::imaproc::attr::Pixels2dPtr ipsdk::imaproc::fd::harrisCorner2d ( const ipsdk::image::ImageConstPtr pInImg,
const ipsdk::ipReal32  inGradStdDev,
const ipsdk::ipUInt64  inNbTotPoints,
const ipsdk::ipUInt32  inFeaturesDist 
)

wrapper function for Extracts the corners in an image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ harrisCorner2d() [3/3]

IPSDKIPLFEATUREDETECTION_API ipsdk::imaproc::attr::Pixels2dPtr ipsdk::imaproc::fd::harrisCorner2d ( const ipsdk::image::ImageConstPtr pInImg,
const ipsdk::ipReal32  inGradStdDev,
const attr::GaussianCoverageConstPtr pInOptGradientGaussianCoverage,
const ipsdk::imaproc::attr::CornerDetectionParamsConstPtr pInCornerDetectionParams,
const ipsdk::ipUInt64  inNbTotPoints,
const ipsdk::ipReal64  inThreshold,
const ipsdk::ipUInt32  inFeaturesDistX,
const ipsdk::ipUInt32  inFeaturesDistY 
)

wrapper function for Extracts the corners in an image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ multiSlice_harrisCorner2d() [2/3]

IPSDKIPLFEATUREDETECTION_API ipsdk::imaproc::attr::PlanIndexedPixels2dPtr ipsdk::imaproc::fd::multiSlice_harrisCorner2d ( const ipsdk::image::ImageConstPtr pInImg,
const ipsdk::ipReal32  inGradStdDev,
const ipsdk::ipUInt64  inNbTotPoints,
const ipsdk::ipUInt32  inFeaturesDist 
)

multi slices version of wrapper function for extracts the corners in an image. This wrapper can be used with multi slice input images

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ multiSlice_harrisCorner2d() [3/3]

IPSDKIPLFEATUREDETECTION_API ipsdk::imaproc::attr::PlanIndexedPixels2dPtr ipsdk::imaproc::fd::multiSlice_harrisCorner2d ( const ipsdk::image::ImageConstPtr pInImg,
const ipsdk::ipReal32  inGradStdDev,
const attr::GaussianCoverageConstPtr pInOptGradientGaussianCoverage,
const ipsdk::imaproc::attr::CornerDetectionParamsConstPtr pInCornerDetectionParams,
const ipsdk::ipUInt64  inNbTotPoints,
const ipsdk::ipReal64  inThreshold,
const ipsdk::ipUInt32  inFeaturesDistX,
const ipsdk::ipUInt32  inFeaturesDistY 
)

multi slices version of wrapper function for extracts the corners in an image. This wrapper can be used with multi slice input images

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure