'**SUMMARY**
matchSIFTKeypoint allows you to match a template image with another image using
SIFT keypoints. The method extracts keypoints from each image, uses the Fast Local
Approximate Nearest Neighbors algorithm to find correspondences between the feature
points, filters the correspondences based on quality.
This method should be able to handle a reasonable changes in camera orientation and
illumination. Using a template that is close to the target image will yield much
better results.
**PARAMETERS**
* *template* - A template image.
* *quality* - The feature quality metric. This can be any value between about 100 and 500. Lower
values should return fewer, but higher quality features.
**RETURNS**
A Tuple of lists consisting of matched KeyPoints found on the image and matched
keypoints found on the template. keypoints are sorted according to lowest distance.
**EXAMPLE**
>>> template = Image("template.png")
>>> img = camera.getImage()
>>> fs = img.macthSIFTKeyPoints(template)
**SEE ALSO**
:py:meth:`_getRawKeypoints`
:py:meth:`_getFLANNMatches`
:py:meth:`drawKeypointMatches`
:py:meth:`findKeypoints`'

def matchSIFTKeyPoints(self, template, quality=200):

    try:
        import cv2
    except ImportError:
        warnings.warn('OpenCV    >=    2.4.3    required')
        return None
    if (not hasattr(cv2, 'FeatureDetector_create')):
        warnings.warn('OpenCV    >=    2.4.3    required')
        return None
    if (template == None):
        return None
    detector = cv2.FeatureDetector_create('SIFT')
    descriptor = cv2.DescriptorExtractor_create('SIFT')
    img = self.getNumpyCv2()
    template_img = template.getNumpyCv2()
    skp = detector.detect(img)
    (skp, sd) = descriptor.compute(img, skp)
    tkp = detector.detect(template_img)
    (tkp, td) = descriptor.compute(template_img, tkp)
    (idx, dist) = self._getFLANNMatches(sd, td)
    dist = (dist[:, 0] / 2500.0)
    dist = dist.reshape((-1)).tolist()
    idx = idx.reshape((-1)).tolist()
    indices = range(len(dist))
    indices.sort(key=(lambda i: dist[i]))
    dist = [dist[i] for i in indices]
    idx = [idx[i] for i in indices]
    sfs = []
    for (i, dis) in itertools.izip(idx, dist):
        if (dis < quality):
            sfs.append(KeyPoint(template, skp[i], sd, 'SIFT'))
        else:
            break
    (idx, dist) = self._getFLANNMatches(td, sd)
    dist = (dist[:, 0] / 2500.0)
    dist = dist.reshape((-1)).tolist()
    idx = idx.reshape((-1)).tolist()
    indices = range(len(dist))
    indices.sort(key=(lambda i: dist[i]))
    dist = [dist[i] for i in indices]
    idx = [idx[i] for i in indices]
    tfs = []
    for (i, dis) in itertools.izip(idx, dist):
        if (dis < quality):
            tfs.append(KeyPoint(template, tkp[i], td, 'SIFT'))
        else:
            break
    return (sfs, tfs)
