Example #1
0
 public String findRobobt3Dmodel(String version)
 {
     // add more list model 3d Robot
     return(GlobalVariables.getPathRobot3DModel());
 }
Example #2
0
        public void setMap()
        {
            //  try
            {
                var mesh = setBorderMap();
                mesh.TextureCoordinates = setMapCollection();
                ImageBrush brush = new ImageBrush();
                //  brush.ImageSource = new BitmapImage(new Uri(pgmMapPath, UriKind.Absolute));
                BitmapImage bi = new BitmapImage(new Uri(pgmMapPath, UriKind.Absolute));;

                var grayBitmapSource = new FormatConvertedBitmap();
                grayBitmapSource.BeginInit();
                grayBitmapSource.Source            = bi;
                grayBitmapSource.DestinationFormat = PixelFormats.Gray32Float;

                grayBitmapSource.EndInit();


                IplImage canny = BitmapConverter.ToIplImage(BitmapImage2Bitmap(bi));
                IplImage img   = new IplImage();
                Cv.Threshold(canny, canny, 15, 255, ThresholdType.BinaryInv);
                IntPtr Dynstorage = CvInvoke.cvCreateMemStorage(0);
                IntPtr Dyncontour = new IntPtr();
                var    contours   = new List <IntPtr>();
                //    Cv.FindContours(canny,contours,0,1);
                //     CvInvoke.cvFindContours(canny,Dynstorage,ref Dyncontour,8,ContourRetrieval.List,ContourChain.ApproxNone);


                Bitmap pp = BitmapConverter.ToBitmap(canny);
                brush.ImageSource = bi;// ToBitmapImage(pp);

                brush.TileMode      = TileMode.None;
                brush.ViewportUnits = BrushMappingMode.Absolute;
                brush.ViewboxUnits  = BrushMappingMode.Absolute;
                brush.Stretch       = Stretch.None;
                brush.AlignmentX    = AlignmentX.Left;
                brush.AlignmentY    = AlignmentY.Top;
                RotateTransform pr = new RotateTransform();

                //pr.CenterX=100;
                // pr.CenterX=100;
                // brush.Transform = new MatrixTransform(-1, 0, 0, 1.0d, -1.0d, -1.0d);
                brush.Transform = new MatrixTransform(1, 0, 0, -1.0d, 0, 0);

                //  brush.RelativeTransform = pr;
                double largesize = bi.PixelWidth <= bi.PixelHeight ? bi.PixelWidth : bi.PixelHeight;
                brush.Viewport = new Rect(-GlobalVariables.ConvertMetertoUnitLength(54.8), GlobalVariables.ConvertMetertoUnitLength(15) - largesize, bi.PixelWidth, bi.PixelHeight);
                DiffuseMaterial mat      = new DiffuseMaterial(brush);
                GeometryModel3D gModel3D = new GeometryModel3D {
                    Geometry = mesh, Material = mat
                };
                pModelMap.Content = gModel3D;
            }
            //catch
            {
                //    MessageBox.Show("Error in loading Map");
            }
        }