img = np.zeros([260, 346])
                img[img_on > 0] = 255
                img[img_off > 0] = 255

                print('*************', img.shape)

                # image = cv2.cvtColor(img[None,:], cv2.COLOR_GRAY2RGB)

                # print('+++++++++++', image.shape)

                image = np.vstack((img, img, img))
                print(image.shape)

                img = np.reshape(image, (3, 260, 346))

                img = img.transpose(1, 2, 0)

                print(img.shape)

                cv2.imshow("image", img / float(clip_value * 2))

            if cv2.waitKey(1) & 0xFF == ord('q'):
                break
        else:
            pass

    except KeyboardInterrupt:
        device.shutdown()
        break
예제 #2
0
                            num_pol_event,
                            special_events,
                            num_special_event,
                            frames_ts,
                            frames,
                            imu_events,
                            num_imu_event,
                        ) = data

                        if pol_events is not None:
                            event_batch = np.concatenate(
                                (event_batch, pol_events))
                            event_batch_size += num_pol_event

                except KeyboardInterrupt:
                    dvs_device.shutdown()
                    break

            event_batch = event_batch[1:, 0:4]

            event_tensor_pd = pd.DataFrame(data=event_batch,
                                           columns=["t", "x", "y", "pol"])
            event_tensor_pd["t"] *= 1e-6
            event_tensor_pd["x"].astype("int16")
            event_tensor_pd["y"].astype("int16")
            event_tensor_pd["pol"].astype("int16")

            last_timestamp = event_tensor_pd.values[-1, 0]

            with Timer("Building event tensor"):
                if args.compute_voxel_grid_on_cpu: