Exemplo n.º 1
0
import numpy as np
import pandas as pd
import cv2
import sklearn
import matplotlib
from modules import LidarFunctions

lf = LidarFunctions()

data_frame = pd.read_csv("data_set.csv")
data_set1 = np.array([data_frame["0"], data_frame["1"]], dtype=np.uint8)
data_set2 = np.array([data_frame["2"], data_frame["3"]], dtype=np.uint8)

print(data_set1)

image1 = lf.draw_point_cloud(data_set1.T, (500, 500))
image2 = lf.draw_point_cloud(data_set2.T, (500, 500))

images = np.hstack((image1, image2))

print(images.shape)

cv2.imshow("Image", cv2.resize(images, (1000, 500)))
cv2.waitKey(0)
cv2.destroyAllWindows()
exit()
Exemplo n.º 2
0
try:
    get_lidar_data.start()

    while True:
        if not lidar_data.empty():
            print("Scan-time:", time.time() - start_time)
            start_time = time.time()
            i, data = lidar_data.get()
            pre_data = lf.prepare_data(data, position)
            mainMap = lf.draw_main_map(pre_data, position, size,
                                       np.zeros(size, np.uint8), 0)
            ImgQueue.put(mainMap)
            Image = ImgQueue.get_image()
            print(pre_data.shape)
            pointcloud = lf.draw_point_cloud(pre_data, size)
            raw_mask = np.array(Motion(last_point_cloud,
                                       pointcloud).motion_detection(100, 0),
                                dtype=np.uint8)
            bmask = cv2.resize(raw_mask, (5000, 5000))
            assert pointcloud.shape == bmask.shape
            mask_img = np.copy(pointcloud)
            np.putmask(mask_img, bmask == False, 0)
            mask = cv2.resize(
                cv2.threshold(raw_mask, 0, 255, cv2.THRESH_BINARY)[1],
                (5000, 5000))
            print("Mask:", mask.shape)
            Image = np.vstack((np.hstack(
                (pointcloud, last_point_cloud)), np.hstack((mask, Image))))
            new_scan_event.set()
            cv2.imshow(