예제 #1
0
파일: losstests.py 프로젝트: Daiver/jff
 def testProjectPoint2Segment07(self):
     p1  = np.array([100, -7])
     p2  = np.array([100, 5])
     p   = np.array([1, 1000])
     res = loss.projectPoint2Segment(p, p1, p2)
     ans = np.array([100, 5])
     self.assertTrue(np.allclose(res, ans))
예제 #2
0
파일: losstests.py 프로젝트: Daiver/jff
 def testProjectPoint2Segment04(self):
     p1  = np.array([0, 0])
     p2  = np.array([1, 0])
     p   = np.array([0.2, -1])
     res = loss.projectPoint2Segment(p, p1, p2)
     ans = np.array([0.2, 0])
     self.assertTrue(np.allclose(res, ans))
예제 #3
0
import numpy as np
import loss

if __name__ == '__main__':
    import cv2
    p1 = np.array([0, 0])
    p2 = np.array([1, 0])
    p  = np.array([0, 1])

    print loss.projectPoint2Segment(p, p1, p2)

예제 #4
0
def correspondeceLines(segments, targetPoints, targetPoints2SegmentsMap):
    return np.array([
        (point, loss.projectPoint2Segment(point, seg[0], seg[1]))
        for point, seg in zip(targetPoints, segments[targetPoints2SegmentsMap])
    ], dtype=np.float32)
예제 #5
0
import numpy as np
import loss

if __name__ == '__main__':
    import cv2
    p1 = np.array([0, 0])
    p2 = np.array([1, 0])
    p = np.array([0, 1])

    print loss.projectPoint2Segment(p, p1, p2)