Akheel K M
Akheel K M

Reputation: 170

Opening image files for load_sift in scikit-image

The documentation for load_sift

from skimage import io img = open('g.png') rv = io.load_sift(img)

This code is not working. It seems that this is not how I'm supposed to open the image file.I could not understand the documentation.

Upvotes: 0

Views: 1006

Answers (1)

Stefan van der Walt
Stefan van der Walt

Reputation: 7253

The load_sift routine is not meant for operating on numpy arrays or image files. As the f parameter is documented, it states:

Input file generated by the feature detectors from
http://people.cs.ubc.ca/~lowe/keypoints/ or
http://www.vision.ee.ethz.ch/~surf/

I.e., these are specially formatted files with the SIFT features already extracted by the binaries found at those URLs. The reason we do not calculate SIFT features inside scikit-image is because those routines are patent encumbered, therefore you have to use an external utility or library to calculate them.

In scikit-image, you read in images as follows:

from skimage import io
image = io.imread('g.png')

This returns a numpy array, that you can manipulate any way you wish. To additionally extract SIFT features:

  1. Download the external binary
  2. Run it on your images
  3. Load the resulting file with load_sift

Because there was uncertainty about the docstring, I have made a patch to clarify that an external tool is needed.

Upvotes: 4

Related Questions