public int[][] Generate(bool document = true)
    {
        if (document)
        {
            //return GenerateWithDocumentation();
        }

        //Generates the GT for all the objects in the objectfolder
        int[][] grids = new int[_som.Count()][];
        for (int objectIndex = 0; objectIndex < _som.Count(); objectIndex++)
        {
            _som.PrepareStudyObject(objectIndex);
            _ogm.ClearGrid();
            RenderAllViews();

            int[] viewGrid  = _ogm.GetViewGrid();
            int[] pointGrid = _ogm.GetPointGrid();

            ReduceGrid(viewGrid, pointGrid);

            grids[objectIndex] = viewGrid;
        }
        _grids = grids;
        _ogm.ClearGrid();
        Debug.Log("Generated grids of " + _som.Count() + " objects");
        return(grids);
    }
Esempio n. 2
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.I)) //Changes the camera view
        {
            NextView();
        }

        if (Input.GetKeyDown(KeyCode.O)) //Changes the study object
        {
            NextObject();
        }
        if (Input.GetKeyDown(KeyCode.L)) //Sets the view to the index of the serialized field
        {
            SetView();
        }
        if (Input.GetKeyDown(KeyCode.K))//Skips 10 candidate view indices forward
        {
            Vector3 v = _vm.SetNeighbouringView(10);
            _drm.SetCameraView(v);
        }
        if (Input.GetKeyDown(KeyCode.Z)) // Renders and adds current view to pointcloud
        {
            Texture2D         _currentRendering = _drm.GetDepthRendering();
            HashSet <Vector3> pointCloud        = _pcm.CreatePointSet(_currentRendering);
            _ogm.AddPoints(pointCloud);
        }
        if (Input.GetKeyDown(KeyCode.X)) // Generates a occupancy grid object on the scene
        {
            _ogm.BuildGrid();
        }
        if (Input.GetKeyDown(KeyCode.C)) //Renders the view from image to point cloud to occupancy grid
        {
            RenderView();
        }
        if (Input.GetKeyDown(KeyCode.B))  //Builds the occupancy grid of the current view
        {
            Texture2D         _currentRendering = _drm.GetDepthRendering();
            HashSet <Vector3> pointCloud        = _pcm.CreatePointSet(_currentRendering);
            _pcm.BuildPointCloudObjectFromCloud(new Vector3(4, 0, 0), pointCloud, Vector3.one);
            _ogm.AddPoints(pointCloud);
            _ogm.BuildGrid();
        }

        if (Input.GetKeyDown(KeyCode.G)) //Shows the ground truth of the current object
        {
            VisualizeGrountTruth();
        }
        if (Input.GetKeyDown(KeyCode.Y)) //Logs the distance between the views
        {
            UnityEngine.Debug.Log(_vm.GetDistance(_vm.GetCurrentViewIndex(), _compareViewWith).ToString());
        }
        if (Input.GetKeyDown(KeyCode.M)) //Shows the view sphere representation
        {
            _vm.BuildSphere(Vector3.zero);
        }
        if (Input.GetKeyDown(KeyCode.N)) //Shows the view sphere representation
        {
            _vm.VisualizePath();
        }
        if (Input.GetKeyDown(KeyCode.P)) //Shows the view sphere representation
        {
            _som.PrepareStudyObject(_setObject);
        }
    }