The underlying data structure is a graph, where each node is an image and each edge is the connectivity between nodes. Nodes and Edges are classes with associated attributes and methods. This notebook primarily focuses on the plotting functionality on the graph (and graph components).
In these notebooks, the graph object is being stored in the variable `cg`. Access to nodes and edges is positional.
* To access a node in the graph: `cg[node_idx]`, e.g. `cg[0]`.
* To access an edge in the graph: `cg[source_idx][destination_idx]`, e.g. `cg[0][1]`
%% Cell type:markdown id: tags:
## Plot the graph
%% Cell type:code id: tags:
``` python
cg.plot()
```
%% Output
/Users/jlaura/anaconda3/envs/autocnet/lib/python3.5/site-packages/matplotlib/collections.py:650: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
if self._edgecolors_original != str('face'):
<matplotlib.axes._subplots.AxesSubplot at 0x123a76208>
%% Cell type:markdown id: tags:
## Plot features at an individual node, e.g. a single image
%% Cell type:markdown id: tags:
All defaults are used here.
%% Cell type:code id: tags:
``` python
cg.node[1].plot()
```
%% Output
<matplotlib.axes._subplots.AxesSubplot at 0x106a721d0>
%% Cell type:markdown id: tags:
This example specifies a plotting layout, passing in an axis object and passes along a color. All the MatPlotLib plotting arguments are supported.
%% Cell type:code id: tags:
``` python
ax1=plt.subplot(1,1,1)
ax=cg.node[0].plot(ax=ax1,color='y')
```
%% Cell type:markdown id: tags:
## Plotting Matches on an Edge
The plotting capability on a given node is limited to a single image; one can envision the node as being the image with all associated metadata and derived information. The edge represents the overlap between images and resultant shared information, e.g. point correspondences, a homography, etc.
%% Cell type:markdown id: tags:
#### Plot the matches between an edge using two outlier detector masks
To get a rough idea of what a 'good' results should be, we should see no, or few, lines which intersect.
/Users/jlaura/anaconda3/envs/autocnet/lib/python3.5/site-packages/matplotlib/collections.py:590: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
if self._edgecolors == str('face'):
<matplotlib.axes._subplots.AxesSubplot at 0x135ac9f98>
%% Cell type:markdown id: tags:
## Compute Coverage Metric
We compute a coverage metric by utilizing the homography to project the destination image corner pixel coordinates into the source image and computing the intersection. This is a rough estimate that is as good (or poor) as the homography.
/Users/jlaura/anaconda3/envs/autocnet/lib/python3.5/site-packages/matplotlib/collections.py:590: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
if self._edgecolors == str('face'):
0.31345856142763456
%% Cell type:markdown id: tags:
The above suggests that the quality is a function of the homography. Just how good is the homography? We can use the determinant (something near 1 is bad), the condition (a very large number, e.g. $10^15$ is bad), or the RMSE (reported in the x and y directions).
%% Cell type:code id: tags:
``` python
H=cg.edge[0][1].homography
print('Not zero is good:',H.determinant)
print('Not huge is good: ',H.condition)
print('Shifts less than one pixel in all directions are good:',H.rmse)
```
%% Cell type:markdown id: tags:
## Viewing Keypoint Information
Here we want to explore the attributes of the keypoints, using the masking information, e.g. the outlier detection methods. The question is, what are the characteristics of those keypoints that have made it through the outlier detection.