plan: SIFT Plan

Contains a class for creating a plan, allocating arrays, compiling kernels and other things like that… to calculate SIFT keypoints and descriptors.

This code implements the SIFT algorithm The SIFT algorithm belongs to the University of British Columbia. It is protected by patent US6711293. If you are on a country where this pattent applies (like the USA), please check if you are allowed to use it. The University of British Columbia does not require a license for its use for non-commercial research applications.

This algorithm is patented: U.S. Patent 6,711,293: “Method and apparatus for identifying scale invariant features in an image and use of same for locating an object in an image”, David Lowe’s patent for the SIFT algorithm, Mar. 8, 1999. It is due to expire in March 2019.

class SiftPlan(shape=None, dtype=None, template=None, PIX_PER_KP=None, init_sigma=None, ctx=None, devicetype='all', platformid=None, deviceid=None, block_size=None, memory=None, profile=False)[source]

This class implements a way to calculate SIFT keypoints.

How to calculate a set of SIFT keypoint on an image:

siftp = sift.SiftPlan(img.shape,img.dtype,devicetype="GPU")
kp = siftp.keypoints(img)

kp is a nx132 array. the second dimension is composed of x,y, scale and angle as well as 128 floats describing the keypoint

This SIFT algorithm is patented: U.S. Patent 6,711,293: “Method and apparatus for identifying scale invariant features in an image and use of same for locating an object in an image”,

compile_kernels()[source]

Call the OpenCL compiler

TODO: use the parameters to define the compile-time constants and use them all in kernels.

keypoints(image, mask=None)[source]

Calculates the keypoints of the image

TODO: use a temporary list with events and use a single test at the end

Parameters:
  • image – ndimage of 2D (or 3D if RGB)
  • mask – TODO: implement a mask for sieving out the keypoints
Returns:

vector of keypoint (1D numpy array)

count_kp(output)[source]

Print the number of keypoint per octave