io.keypoints — Keypoint Serialization

The io.keypoints module provides methods for serializing keypoints objects.

New in version 0.1.0.

autocnet.io.keypoints.create_output_path(filename, outdir=None)[source]

Given a filename for keypoints and descriptors, create an output directory with _kps.h5 appended.

Parameters
  • filename (str) – The filename or full path

  • outdir (str) – An optional output path

Returns

outh5 – Path of the output h5 file

Return type

str

autocnet.io.keypoints.from_hdf(in_path, index=None, keypoints=True, descriptors=True)[source]

For a given node, load the keypoints and descriptors from a hdf5 file. The keypoints and descriptors kwargs support returning only keypoints or descriptors. The index kwarg supports returning a subset of the data.

Parameters
  • in_path (str) – handle to the file

  • key (str) – An optional path into the HDF5. For example key=’image_name’, will search /image_name/descriptors for the descriptors.

  • index (iterable) – an h5py accepted indexer to pull only a subset of the keypoints off disk. Default is None to pull all keypoints.

  • keypoints (bool) – if True (default) return the keypoints

  • descriptors (bool) – if True (default) return the descriptors

Returns

  • keypoints (DataFrame) – A pandas dataframe of keypoints.

  • descriptors (ndarray) – A numpy array of descriptors

autocnet.io.keypoints.from_npy(in_path)[source]

Load keypoints and descriptors from a .npz file.

Parameters

in_path (str) – PATH to the npz file

Returns

  • keypoints (DataFrame) – of keypoints

  • descriptors (ndarray) – of feature descriptors

autocnet.io.keypoints.to_hdf(out_path, keypoints=None, descriptors=None, key=None)[source]

Save keypoints and descriptors to HDF at a given out_path at either the root or at some arbitrary path given by a key.

Parameters
  • keypoints (DataFrame) – Pandas dataframe of keypoints

  • descriptors (ndarray) – of feature descriptors

  • out_path (str) – to the HDF5 file

  • key (str) – path within the HDF5 file. If given, the keypoints and descriptors are save at <key>/keypoints and <key>/descriptors respectively.

autocnet.io.keypoints.to_npy(keypoints, descriptors, out_path)[source]

Save keypoints and descriptors to a .npz file at some out_path

Parameters
  • keypoints (DataFrame) – of keypoints

  • descriptors (ndarray) – of feature descriptors

  • out_path (str) – PATH and filename to save the features