This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from numpy import arccos, array, dot, pi | |
from numpy.linalg import det, norm | |
def distance(A, B, P): | |
""" segment line AB, point P, where each one is an array([x, y]) """ | |
if all(A == P) or all(B == P): | |
return 0 | |
if arccos(dot((P - A) / norm(P - A), (B - A) / norm(B - A))) > pi / 2: | |
return norm(P - A) | |
if arccos(dot((P - B) / norm(P - B), (A - B) / norm(A - B))) > pi / 2: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# Copyright 2016 Massachusetts Institute of Technology | |
"""Extract images from a rosbag. | |
""" | |
import os | |
import argparse |