27 #ifndef VIGRA_EXT_INTEREST_POINTS
28 #define VIGRA_EXT_INTEREST_POINTS
33 #include <vigra/error.hxx>
34 #include <vigra/impex.hxx>
35 #include <vigra/cornerdetection.hxx>
36 #include <vigra/localminmax.hxx>
37 #include <vigra/diff2d.hxx>
42 template <
class ImageIter,
class ImageAcc>
44 unsigned nPoints, std::multimap<double, vigra::Diff2D> &points
54 vigra::BImage leftCorners(rect.size(), vigra::UInt8(0));
55 vigra::FImage leftCornerResponse(rect.size());
57 DEBUG_DEBUG(
"running corner detector. nPoints: " << nPoints <<
", scale: " << scale);
59 vigra::cornerResponseFunction(srcIterRange(img.first + rect.upperLeft(), img.first + rect.lowerRight(), img.third),
65 double minResponse = 0;
68 for (
int y = 0; y < rect.height(); y++)
70 for (
int x = 0; x < rect.width(); x++)
72 if (leftCorners(x, y) == 0)
76 double resp = leftCornerResponse(x, y);
77 if (resp > minResponse)
80 points.insert(std::make_pair(resp, vigra::Diff2D(x, y) + rect.upperLeft()));
86 if (points.size() > nPoints)
89 points.erase(points.begin());
91 minResponse = points.begin()->first;
void findInterestPointsPartial(vigra::triple< ImageIter, ImageIter, ImageAcc > img, const vigra::Rect2D &rect, double scale, unsigned nPoints, std::multimap< double, vigra::Diff2D > &points)
vigra::pair< typename ROIImage< Image, Alpha >::image_traverser, typename ROIImage< Image, Alpha >::ImageAccessor > destImage(ROIImage< Image, Alpha > &img)
vigra::triple< typename ROIImage< Image, Mask >::image_const_traverser, typename ROIImage< Image, Mask >::image_const_traverser, typename ROIImage< Image, Mask >::ImageConstAccessor > srcImageRange(const ROIImage< Image, Mask > &img)
helper function for ROIImages