def testFindCameraSpacePointsFour(): v = Connections() srcPts01 = np.array([[1, 1], [8, 8], [17, 17]]) dstPts01 = np.array([[2, 2], [9, 9], [18, 18]]) v.addConnection(0, 1, None, None, srcPts01, dstPts01) srcPts02 = np.array([[5, 5], [19, 19]]) dstPts02 = np.array([[7, 7], [20, 20]]) v.addConnection(0, 2, None, None, srcPts02, dstPts02) srcPts03 = np.array([[8, 8], [11, 11]]) dstPts03 = np.array([[10, 10], [13, 13]]) v.addConnection(0, 3, None, None, srcPts03, dstPts03) srcPts12 = np.array([[2, 2], [6, 6], [14, 14], [21, 21]]) dstPts12 = np.array([[3, 3], [7, 7], [15, 15], [22, 22]]) v.addConnection(1, 2, None, None, srcPts12, dstPts12) srcPts13 = np.array([[14, 14], [23, 23]]) dstPts13 = np.array([[16, 16], [24, 24]]) v.addConnection(1, 3, None, None, srcPts13, dstPts13) srcPts23 = np.array([[3, 3], [12, 12], [25, 25]]) dstPts23 = np.array([[4, 4], [13, 13], [26, 26]]) v.addConnection(2, 3, None, None, srcPts23, dstPts23) # v.debugConnections() listOfMatches = [] discovered = [dict(), dict(), dict(), dict()] v.findMatches(listOfMatches, discovered) [match.debugViews() for match in listOfMatches]
def Guard(): #checks were current connections are, and if not approved locations, reports it. global locations ip_con = Connections.Connections('ip') #find the ip connections ip_dom = Connections.Connections('domain') #find domain connections ip_loc = '' for ip in ip_con: #get locations of ip connections ip_loc = ip_loc + Locate.Locate(ip) + '\n' dom_loc = '' for d in ip_dom: #get locations of domain connections dom_loc = dom_loc + Locate.Locate(DomainLookup.Domain_to_IP(d)) + '\n' locations = ip_loc + '\n' + dom_loc states = Locate.FindStates(locations) #finds the states of the connections for s in states: #check to see if in approved locaitons if (s == 'RI' or s == 'NY'): continue else: return True #if there is a problem, returns true return False #otherwise returns false
def testFindCameraSpacePointsTwo(): v = Connections() srcPts = np.array([[1, 1], [3, 3], [5, 5]]) dstPts = np.array([[2, 2], [4, 4], [6, 6]]) v.addConnection(0, 1, None, None, srcPts, dstPts) v.debugConnections() listOfMatches = [] discovered = [dict(), dict()] v.findMatches(listOfMatches, discovered) [match.debugViews() for match in listOfMatches]
def testFindCameraSpacePointsThree(): v = Connections() srcPts01 = np.array([[1, 1], [4, 4]]) dstPts01 = np.array([[2, 2], [5, 5]]) v.addConnection(0, 1, None, None, srcPts01, dstPts01) srcPts02 = np.array([[8, 8]]) dstPts02 = np.array([[9, 9]]) v.addConnection(0, 2, None, None, srcPts02, dstPts02) srcPts12 = np.array([[2, 2], [6, 6]]) dstPts12 = np.array([[3, 3], [7, 7]]) v.addConnection(1, 2, None, None, srcPts12, dstPts12) # v.debugConnections() listOfMatches = [] discovered = [dict(), dict(), dict()] v.findMatches(listOfMatches, discovered) [match.debugViews() for match in listOfMatches]
def __init__(self, layers): """ 初始化一个全连接神经网络 :param layers: 二维数组,描述神经网络每层节点数 """ self.connections = Connections() self.layers = [] layer_count = len(layers) node_count = 0 for i in range(layer_count): self.layers.append(Layer(i, layers[i])) for layer in range(layer_count - 1): connections = [ Connection(upstream_node, downstream_node) for upstream_node in self.layers[layer].nodes for downstream_node in self.layers[layer + 1].node[:-1] ] for conn in connections: self.connections.add_connection(conn) conn.downstream_node.append_upstream_connection(conn) conn.upstream_node.append_downstream_connection(conn)
def testAddOneConnection(R01, t01): v = Connections() v.addConnection(0, 1, R01, t01, None, None) v.debugConnections()
def __init__(self): self.complete = False self.db = Connections.Connections()
] # convert ppm to numpy array images = [cv2.imread(f, cv2.IMREAD_GRAYSCALE) for f in imgFiles] # images = images[0:2] numImages = len(images) # load the camera matrices matrixFiles = [open(f) for f in cameraFiles] matrixList = [np.zeros((3, 3)) for f in cameraFiles] for i in range(len(matrixFiles)): for j in range(3): row = matrixFiles[i].readline().split() for k in range(3): matrixList[i][j, k] = np.float(row[k]) # instantiate viewSet object c = Connections(len(images)) # set instrinsics c.setIntrinsics(matrixList[0]) # fill connection table for i in range(numImages): for j in range(i + 1, numImages): R, t, srcPts, dstPts = estimateRelativeExtrinsics( images[i], images[j], i, j, c.intrinsics) # estimate time 35.433154821395874 c.addConnection(i, j, R, t, srcPts, dstPts) # find the matches listOfMatches = [] discovered = [dict() for i in range(numImages)]