コード例 #1
0
        /*
         * Point cloud color:
         * AntiqueWhite is ref
         * YellowGreen is pending
         * blue is established
         */
        private void TransformPC(Point3DCollection source, Point3DCollection reference)
        {
            // As far as i know, source[i] maps to reference[i]
            // compute initial transformation

            //compute transformation from reference
            _icpData = _icp.ComputeICP(
                Parser3DPoint.FromPoint3DToDataPoints(source),
                Parser3DPoint.FromPoint3DToDataPoints(reference),
                _initialTransformation);

            _icpData.transform = _initialTransformation;

            var p = ICP.ApplyTransformation(_icpData.transform, Parser3DPoint.FromPoint3DToDataPoints(_displayPointCloud));

            _displayPointCloud = Parser3DPoint.FromDataPointsToPoint3DCollection(p);

            _renderer.CreatePointCloud(_displayPointCloud, Brushes.BlueViolet);
        }
コード例 #2
0
        private void Init()
        {
            InitializeComponent();
            Log.InitLog(textBox, label_Cycle);


            // Initialize images
            _processingStage = new ProcessingStage(label_Status,
                                                   new BitmapImage(new Uri("pack://application:,,,/3DReconstructionWPF;component/Assets/Images/icons8-crossmark.png")),
                                                   new BitmapImage(new Uri("pack://application:,,,/3DReconstructionWPF;component/Assets/Images/icons8-checkmark.png")),
                                                   image_trackedFeature, image_rgbColor, image_depth);

            _renderer = new Renderer(group);
            _pcv      = new PointCloudView(_renderer);

            _sensor = KinectSensor.GetDefault();

            _initialTransformation = new pointmatcher.net.EuclideanTransform
            {
                translation = System.Numerics.Vector3.Zero,
                rotation    = System.Numerics.Quaternion.Normalize(System.Numerics.Quaternion.CreateFromRotationMatrix(new System.Numerics.Matrix4x4(
                                                                                                                           1, 0, 0, 0,
                                                                                                                           0, 1, 0, 0,
                                                                                                                           0, 0, 1, 0,
                                                                                                                           0, 0, 0, 1
                                                                                                                           )))
            };

            _icpData            = new ICP.ICPData(null, _initialTransformation);
            _icp                = new ICP();
            label_Cycle.Content = "cycle: " + _cycleRuns;

            if (_sensor != null)
            {
                if (_sensor.IsOpen && _sensor.IsAvailable)
                {
                    Log.WriteLog("Kinect capture data available!");
                }
            }

            // Init filters
            FilterGroup.InitFilters();
        }