22 #ifndef otbSiftFastImageFilter_hxx
23 #define otbSiftFastImageFilter_hxx
27 #include "otb_siftfast.h"
28 #include "itkContinuousIndex.h"
29 #include "itkImageRegionConstIterator.h"
36 template <
class TInputImage,
class TOutputPo
intSet>
41 template <
class TInputImage,
class TOutputPo
intSet>
49 typename InputImageType::SizeType size = inputPtr->GetLargestPossibleRegion().GetSize();
51 SiftFastImage siftInputImage = CreateImage(size[1], size[0]);
52 itk::ImageRegionConstIterator<TInputImage> inIt(inputPtr, inputPtr->GetBufferedRegion());
54 unsigned int index = 0;
56 for (inIt.GoToBegin(); !inIt.IsAtEnd(); ++inIt)
58 siftInputImage->pixels[index] =
static_cast<float>(inIt.Get());
62 Keypoint keypts = GetKeypoints(siftInputImage, m_ScalesNumber);
64 Keypoint key = keypts;
66 unsigned int numkeys = 0;
71 itk::ContinuousIndex<float, 2> keyContIndex;
72 keyContIndex[0] = key->col;
73 keyContIndex[1] = key->row;
76 inputPtr->TransformContinuousIndexToPhysicalPoint(keyContIndex, point);
81 for (
int i = 0; i < 128; ++i)
83 data[i] = key->descrip[i];
85 outputPointSet->SetPoint(numkeys, point);
86 outputPointSet->SetPointData(numkeys, data);
89 std::pair<OutputPointType, double> pair;
91 pair.second = key->ori;
92 m_OrientationVector.push_back(pair);
100 FreeKeypoints(keypts);
101 DestroyAllResources();
106 template <
class TInputImage,
class TOutputPo
intSet>
109 Superclass::PrintSelf(os, indent);