def __init__(self, memory, instructions_per_frame, hdd): self._memory = memory self._instructions_per_frame = instructions_per_frame self._memory_size = self._memory.size() self._frames = [] self.generate_frames() self._frame_manager = FrameManager(self._frames, hdd) self._page_creator = PageCreator()
VizUtils.quickDisplayOrtho("MainWindow", points, StandardBody.standardColors) def visualizeFrame(rgb): #First, resize to 512 x 424 resized = cv2.resize(rgb, (424, 512)) cv2.imshow("Frame", resized) cv2.waitKey(10) sequenceRoot = sys.argv[1] rootDirector = RootDirector(sequenceRoot) for recordingName in rootDirector.getPeopleRecordingNames(): recordingPath = os.path.join(rootDirector.getDirectoryPath(), recordingName) #Look inside the autoLabels path there autoLabelsPath = os.path.join(recordingPath, "autoLabels") recordingZeroCamPath = os.path.join(recordingPath, "0") frameManager = FrameManager(recordingZeroCamPath) subs = os.listdir(autoLabelsPath) subs.sort() for sub in subs: full = os.path.join(autoLabelsPath, sub) labelReader = AutoLabelReader(full) N = labelReader.getNumLabels() for i in range(N): points = labelReader.getLabel(i) timestamp = labelReader.getTimestamp(i) while (frameManager.getViewTime() < timestamp): frameManager.tryAdvance(1) visualizeFrame(frameManager.getFrame().getRGB()) visualizePoints(points)
return A[np.random.choice(A.shape[0], num_rows, replace=False)] if __name__ == '__main__': sequenceRootRoot = sys.argv[1] emptySequenceDirs = [ y for x in os.walk(sequenceRootRoot) for y in glob(os.path.join(x[0], '*empty*/')) ] cameraLabels = ["0", "1", "2"] rgbFrames = [] for sequenceDir in emptySequenceDirs: for cam in cameraLabels: fullPath = os.path.join(sequenceDir, cam) if (os.path.isdir(fullPath)): frameManager = FrameManager(fullPath) LIMIT = 20 i = 0 while True: frame = frameManager.getFrame() #Great -- take all of the i += 1 if (i == LIMIT): rgbFrames.append(frame.getRGB()) break advanced = frameManager.tryAdvance(1) if (not advanced): break rgbFrames = np.reshape(np.array(rgbFrames), (-1, 3)).astype(np.float32) / 255.0
def visualize(X, ax): plt.cla() ax.scatter(X[:, 0], X[:, 1], X[:, 2], color='red', label='Colors') plt.draw() plt.pause(0.001) def randomRows(A, num): return A[np.random.choice(A.shape[0], num, replace=False), :] sequenceRoot = sys.argv[1] frameManager = FrameManager(sequenceRoot) colorCollection = [] keepRows = 50 visited = 0 while True: frame = frameManager.getFrame() rgb = frame.getRGB() #rgb = cv2.GaussianBlur(rgb, (11, 11), 5) hsv = cv2.cvtColor(rgb, cv2.COLOR_BGR2HSV) reshaped = hsv.reshape(-1, hsv.shape[-1])