示例#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)