graph.node — Network Node Object

The graph.node module contains the Node class. This is an extension to the NetworkX Node.

New in version 0.1.0.

class autocnet.graph.node.NetworkNode(*args, **kwargs)[source]
property camera

Get the camera object from the database.

create_camera(url)[source]

Creates a CSM sensor for the node and serializes the state to the DB,

Parameters

url (str) – The URI to a service that can create an ISD to instantiate a sensor.

property ignore

Gets the ignore flag from the Images table

property nkeypoints

Get the number of keypoints from the database

class autocnet.graph.node.Node(image_name=None, image_path=None, node_id=None)[source]

This class represents a node in a graph and is synonymous with an image. The node (image) stores PATH information, an accessor to the on-disk data set, and correspondences information that references the image.

image_name

Name of the image, with extension

Type

str

image_path

Relative or absolute PATH to the image

Type

str

geodata

File handle to the object

Type

object

keypoints

With columns, x, y, and response

Type

dataframe

nkeypoints

The number of keypoints found for this image

Type

int

descriptors

32-bit array of feature descriptors returned by OpenCV

Type

ndarray

masks

A list of the available masking arrays

Type

set

ignore

If the image is flagged as ignored and will be skipped in processing

Type

bool

isis_serial

If the input images have PVL headers, generate an ISIS compatible serial number

Type

str

coverage()[source]

Determines the area of keypoint coverage using the unprojected image, resulting in a rough estimation of the percentage area being covered.

Returns

coverage_area – percentage area covered by the generated keypoints

Return type

float

extract_features_with_downsampling(downsample_amount, array_read_args={}, *args, **kwargs)[source]

Extract interest points for the this node (image) by first downsampling, then applying the extractor, and then upsampling the results backin to true image space.

Parameters

downsample_amount (int) – The amount to downsample by

get_array(band=1, **kwargs)[source]

Get a band as a 32-bit numpy array

Parameters

band (int) – The band to read, default 1

get_byte_array(band=1)[source]

Get a band as a 32-bit numpy array

Parameters

band (int) – The band to read, default 1

get_keypoint_coordinates(index=None, homogeneous=False)[source]

Return the coordinates of the keypoints without any ancillary data

Parameters
  • index (iterable) – indices for of the keypoints to return

  • homogeneous (bool) – If True, return homogeneous coordinates in the form [x, y, 1]. Default: False

Returns

A pandas dataframe of keypoint coordinates

Return type

dataframe

get_keypoints(index=None)[source]

Return the keypoints for the node. If index is passed, return the appropriate subset. :param index: indices for of the keypoints to return :type index: iterable

Returns

A pandas dataframe of keypoints

Return type

dataframe

get_raw_keypoint_coordinates(index=slice(None, None, None))[source]

The performance of get_keypoint_coordinates can be slow due to the ability for fancier indexing. This method returns coordinates using numpy array accessors.

Parameters

index (iterable) – positional indices to return from the global keypoints dataframe

property isis_serial

Generate an ISIS compatible serial number using the data file associated with this node. This assumes that the data file has a PVL header.

load_features(in_path, format='npy', **kwargs)[source]

Load keypoints and descriptors for the given image from a HDF file.

Parameters
  • in_path (str or object) – PATH to the hdf file or a HDFDataset object handle

  • format ({'npy', 'hdf'}) – The format that the features are stored in. Default: npy.

reproject_geom(coords)[source]

Reprojects a set of latlon coordinates into pixel space using the nodes geodata. These are then returned as a shapely polygon

Parameters

coords (ndarray) – (n, 2) array of latlon coordinates

Returns

A shapely polygon object made using the reprojected coordinates

Return type

object

save_features(out_path)[source]

Save the extracted keypoints and descriptors to the given file. By default, the .npz files are saved along side the image, e.g. in the same folder as the image.

Parameters

out_path (str or object) – PATH to the directory for output and base file name