GDAL
gdal_simplesurf.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Project: GDAL
3  * Purpose: Correlator
4  * Author: Andrew Migal, migal.drew@gmail.com
5  *
6  ******************************************************************************
7  * Copyright (c) 2012, Andrew Migal
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining a
10  * copy of this software and associated documentation files (the "Software"),
11  * to deal in the Software without restriction, including without limitation
12  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13  * and/or sell copies of the Software, and to permit persons to whom the
14  * Software is furnished to do so, subject to the following conditions:
15  *
16  * The above copyright notice and this permission notice shall be included
17  * in all copies or substantial portions of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25  * DEALINGS IN THE SOFTWARE.
26  ****************************************************************************/
27 
34 #ifndef GDALSIMPLESURF_H_
35 #define GDALSIMPLESURF_H_
36 
37 #include "gdal_priv.h"
38 #include "cpl_conv.h"
39 #include <list>
40 
50 {
51 public:
57 
63 
76  GDALFeaturePoint(int nX, int nY, int nScale, int nRadius, int nSign);
77  virtual ~GDALFeaturePoint();
78 
79  GDALFeaturePoint& operator=(const GDALFeaturePoint& point);
80 
90  double& operator[](int nIndex);
91 
92  // Descriptor length
93  static const int DESC_SIZE = 64;
94 
100  int GetX();
101 
107  void SetX(int nX);
108 
114  int GetY();
115 
121  void SetY(int nY);
122 
128  int GetScale();
129 
135  void SetScale(int nScale);
136 
142  int GetRadius();
143 
149  void SetRadius(int nRadius);
150 
156  int GetSign();
157 
163  void SetSign(int nSign);
164 
165 private:
166  // Coordinates of point in image
167  int nX;
168  int nY;
169  // --------------------
170  int nScale;
171  int nRadius;
172  int nSign;
173  // Descriptor array
174  double *padfDescriptor;
175 };
176 
187 {
188 public:
190  virtual ~GDALIntegralImage();
191 
199  void Initialize(const double **padfImg, int nHeight, int nWidth);
200 
209  double GetValue(int nRow, int nCol);
210 
222  double GetRectangleSum(int nRow, int nCol, int nWidth, int nHeight);
223 
233  double HaarWavelet_X(int nRow, int nCol, int nSize);
234 
244  double HaarWavelet_Y(int nRow, int nCol, int nSize);
245 
251  int GetHeight();
252 
258  int GetWidth();
259 
260 private:
261  double **pMatrix;
262  int nWidth;
263  int nHeight;
264 };
265 
275 {
276 public:
277  GDALOctaveLayer();
278 
287  GDALOctaveLayer(int nOctave, int nInterval);
288  virtual ~GDALOctaveLayer();
289 
299  void ComputeLayer(GDALIntegralImage *poImg);
300 
312  int radius;
316  int scale;
320  int width;
324  int height;
328  double **detHessians;
332  int **signs;
333 };
334 
342 {
343 public:
350  GDALOctaveMap(int nOctaveStart, int nOctaveEnd);
351  virtual ~GDALOctaveMap();
352 
359  void ComputeMap(GDALIntegralImage *poImg);
360 
378  bool PointIsExtremum(int row, int col, GDALOctaveLayer *bot,
379  GDALOctaveLayer *mid, GDALOctaveLayer *top, double threshold);
380 
385 
389  static const int INTERVALS = 4;
390 
395 
400 };
401 
414 {
415 private:
420  class MatchedPointPairInfo
421  {
422  public:
423  MatchedPointPairInfo(int nInd_1, int nInd_2, double dfDist)
424  {
425  ind_1 = nInd_1;
426  ind_2 = nInd_2;
427  euclideanDist = dfDist;
428  }
429 
430  int ind_1;
431  int ind_2;
432  double euclideanDist;
433  };
434 
435 public:
457  GDALSimpleSURF(int nOctaveStart, int nOctaveEnd);
458  virtual ~GDALSimpleSURF();
459 
476  static CPLErr ConvertRGBToLuminosity(
477  GDALRasterBand *red,
478  GDALRasterBand *green,
479  GDALRasterBand *blue,
480  int nXSize, int nYSize,
481  double **padfImg, int nHeight, int nWidth);
482 
497  std::vector<GDALFeaturePoint>*
498  ExtractFeaturePoints(GDALIntegralImage *poImg, double dfThreshold);
499 
512  static CPLErr MatchFeaturePoints(
513  std::vector<GDALFeaturePoint*> *poMatchPairs,
514  std::vector<GDALFeaturePoint> *poFirstCollect,
515  std::vector<GDALFeaturePoint> *poSecondCollect,
516  double dfThreshold);
517 
518 private:
528  static double GetEuclideanDistance(
529  GDALFeaturePoint &firstPoint, GDALFeaturePoint &secondPoint);
530 
536  static void NormalizeDistances(std::list<MatchedPointPairInfo> *poList);
537 
544  void SetDescriptor(GDALFeaturePoint *poPoint, GDALIntegralImage *poImg);
545 
546 
547 private:
548  int octaveStart;
549  int octaveEnd;
550  GDALOctaveMap *poOctMap;
551 };
552 
553 
554 #endif /* GDALSIMPLESURF_H_ */
int GetY()
Fetch Y-coordinate (line) of point.
Definition: gdal_simplesurf.cpp:99
int octaveNum
Octave which contains this layer (1,2,3...)
Definition: gdal_simplesurf.h:304
int height
Image height in pixels.
Definition: gdal_simplesurf.h:324
Class for handling octave layers in SURF-based algorithm.
Definition: gdal_simplesurf.h:341
int scale
Scale for this layer.
Definition: gdal_simplesurf.h:316
void SetSign(int nSign)
Set sign of point.
Definition: gdal_simplesurf.cpp:109
Class for searching corresponding points on images.
Definition: gdal_simplesurf.h:413
void SetScale(int nScale)
Set scale of point.
Definition: gdal_simplesurf.cpp:103
Class of "feature point" in raster.
Definition: gdal_simplesurf.h:49
double ** detHessians
Hessian values for image pixels.
Definition: gdal_simplesurf.h:328
GDALOctaveLayer *** pMap
2-dimensional array of octave layers
Definition: gdal_simplesurf.h:384
GDALFeaturePoint()
Standard constructor.
Definition: gdal_simplesurf.cpp:38
int GetSign()
Fetch sign of Hessian determinant of point.
Definition: gdal_simplesurf.cpp:108
int GetRadius()
Fetch radius of point.
Definition: gdal_simplesurf.cpp:105
int radius
Length of the border.
Definition: gdal_simplesurf.h:312
void SetY(int nY)
Set Y coordinate of point.
Definition: gdal_simplesurf.cpp:100
Integral image class (summed area table).
Definition: gdal_simplesurf.h:186
double & operator[](int nIndex)
Provide access to point&#39;s descriptor.
Definition: gdal_simplesurf.cpp:111
int ** signs
Hessian signs for speeded matching.
Definition: gdal_simplesurf.h:332
int width
Image width in pixels.
Definition: gdal_simplesurf.h:320
Various convenience functions for CPL.
int GetX()
Fetch X-coordinate (pixel) of point.
Definition: gdal_simplesurf.cpp:96
int octaveEnd
Number of top octave.
Definition: gdal_simplesurf.h:399
int filterSize
Length of the side of filter.
Definition: gdal_simplesurf.h:308
int GetScale()
Fetch scale of point.
Definition: gdal_simplesurf.cpp:102
A single raster band (or channel).
Definition: gdal_priv.h:475
void SetRadius(int nRadius)
Set radius of point.
Definition: gdal_simplesurf.cpp:106
int octaveStart
Number of bottom octave.
Definition: gdal_simplesurf.h:394
Class for computation and storage of Hessian values in SURF-based algorithm.
Definition: gdal_simplesurf.h:274
void SetX(int nX)
Set X coordinate of point.
Definition: gdal_simplesurf.cpp:97

Generated for GDAL by doxygen 1.8.11.