Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
Oli4 committed Oct 31, 2019
1 parent 8fb4755 commit f5b451a
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions notebooks/NIR_CFP_registration.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@
},
{
"cell_type": "code",
"execution_count": 592,
"execution_count": 602,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -862,33 +862,40 @@
" dest_index, dest_dist = ann(src_features, dest_features)\n",
" src_index, src_dist = ann(dest_features, src_features)\n",
" \n",
" \n",
" matches = {}\n",
" \n",
" for i in np.ndindex(src_index.shape[:-1]):\n",
" # i is the position in the src_index\n",
" # nn_srcdest is the index of the nearest neighbour in dest \n",
" nn_srcdest = tuple(src_index[i])\n",
" # \n",
" nn_destsrc = dest_index[nn_srcdest]\n",
" if i == tuple(nn_destsrc):\n",
" matches[src_dist[i]] = [i, tuple(dest_index[i])]\n",
" position_nn_in_dest = tuple(src_index[i])\n",
" nn_in_dest = tuple(dest_index[position_nn_in_dest])\n",
" if i == nn_in_dest:\n",
" print(i, nn_in_dest)\n",
" matches[src_dist[i]] = [i, ]\n",
" \n",
" return matches"
]
},
{
"cell_type": "code",
"execution_count": 593,
"execution_count": 603,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(1, 0) (1, 0)\n",
"(1, 1) (1, 1)\n"
]
},
{
"data": {
"text/plain": [
"{0: [(1, 0), (1, 0)], 1: [(1, 1), (1, 0)]}"
]
},
"execution_count": 593,
"execution_count": 603,
"metadata": {},
"output_type": "execute_result"
}
Expand Down

0 comments on commit f5b451a

Please sign in to comment.