                                libkeypoint TODO
                               ==================

Bugs/Fixes
----------

* get_supported_keypoint_types() may return GPU feature types event if the 
  graphics card is inadequate. All the required OpenGL extensions should be 
  checked. There should be code to do this in the CUDA-SIFT sources.

* This test passes:
    ./bin/test_keypoints test_data/left.jpg test_data/right.jpg

  while this test fails
    ./bin/test_keypoints ${PWD}/test_data/left.jpg ${PWD}/test_data/right.jpg

  I've run valgrind over it, and the second test passes. There are lots of
  warnings for use of uninitialised values in the SURF stuff, but it doesn't
  look like I'm doing anything wrong. This probably needs to be fixed in 
  libsurf.so


Thread-Safety
-------------

It should be possible to get multithreaded GPU keypoint finding working 
either by having an OpenGL context associated with each Keypoint_Finder 
object. The current GPU-SIFT, CUDA-SIFT and GPU-SURF code all want to create
their own context rather than using the current one however.
  
I suspect there isn't any advantage to doing multithreaded GPU keypoint finding
though. While the GPU allows lots of parallell computation, I assume this is 
already happening when one image is being processed in lots of small chunks.

What might be possible is to use X/GLX calls to get the current OpenGL context 
after is has been initially created in the first thread, then set the current 
OpenGL context in other threads, and use mutex to keep it all threadsafe.

To prevent exit() being called due to multiple glut initialisations, a flag
should be set once one type of GPU feature detection is set. If another type
of GPU keypoint feature finding is attempted, an exception should be thrown.


Clean-up
--------

* Figure out how to handle the vector of const pointers or vector of pointers
  problem with write_keypoints. Other functions like draw_keypoints are
  probably the same.
  
* Find all bits of code in the keypoint tests, libsnapper and 
  seabed_localisation where I check for each type of feature, and add 
  functions to do it in this library. Adding a new feature should not require
  changes to the code in other libraries.
   - Add a function set_threshold to the Keypoint_Options structure. Remove
     repeated code to check feature type and set the appropriate threshold
     in the keypoint tests and seabed_slam_display. 

* Move sum of square differences code into a separate file?


Performance
-----------

* Why is calling square_diff_sum in SIFT_Keypoint::squared_dist slow?

* Speed-up image conversion from OpenCV to SIFT and SURF formats.
  
* Speed-up calculation of feature description distances. When using the dot
  product method for normalised descriptors, the distance from one feature to
  many could be impemented as a vector-matrix multiply, which may be faster.
  The distance between many to many keypoints could be implemented as a 
  matrix-matrix multiply, although the matrices could get very big.


Additions
---------

* Make checking the sign of the laplacian when matching SURF features optional.

* Support different matching methods:
   - nearest neighbour ratio (currently used)
   - best match below a threshold
   - mutual agreement matching

