Harris Corner Detector Code Snippet¶
This code snippet shows how to retrieve corners’ coordinates by means of the Harris corner detector algorithm.
C++¶
#include <eVision/EasyImage/EHarrisCornerDetector.h>
using namespace eVision;
// Image constructor
EImageBW8 srcImage;
// ...
// Harris corner detector
EHarrisCornerDetector harris;
EHarrisInterestPoints interestPoints;
harris.SetIntegrationScale(2.f);
// Perform the corner detection
harris.Apply(srcImage, interestPoints);
// Retrieve the number of corners
unsigned int index = interestPoints.GetPointCount();
// Retrieve the first corner coordinates
EPoint point = interestPoints.GetPoint(0);
float x = point.GetX();
float y = point.GetY();
C#¶
using eVision;
// Image constructor
EImageBW8 srcImage = new EImageBW8();
// ...
// Harris corner detector
EHarrisCornerDetector harris = new EHarrisCornerDetector();
EHarrisInterestPoints interestPoints = new EHarrisInterestPoints();
harris.IntegrationScale = 2.0f;
// Perform the corner detection
harris.Apply(srcImage, interestPoints);
// Retrieve the number of corners
uint index = interestPoints.PointCount;
// Retrieve the first corner coordinates
EPoint point = interestPoints.GetPoint(0);
float x = point.X;
float y = point.Y;
Python¶
import eVision
# Image constructor
src_image = eVision.EImageBW8()
# ...
# Harris corner detector
harris = eVision.EHarrisCornerDetector()
interestPoints = eVision.EHarrisInterestPoints()
harris.IntegrationScale = 2.0
# Perform the corner detection
harris.Apply(src_image, interestPoints)
# Retrieve the number of corners
index = interestPoints.PointCount
# Retrieve the first corner coordinates
point = interestPoints.GetPoint(0)
x = point.X
y = point.Y