public IEnumerable<Image> GetUploadedImages(HttpRequestBase request, params string[] imageDefinitionKeys)
        {
            List<Image> images = new List<Image>();

            foreach (string inputTagName in request.Files)
            {
                HttpPostedFileBase file = request.Files[inputTagName];
                if (file.ContentLength > 0)
                {
                    // upload the image to filesystem
                    if (IsNotImage(file))
                    {
                        throw new ValidationException(string.Format("File '{0}' is not an image file (*.jpg)", file.FileName));
                    }

                    Image image = new Image
                    {
                        FileName = Guid.NewGuid(),
                        Description = Path.GetFileName(file.FileName)
                    };

                    file.SaveAs(imageFileService.GetFullPath(image.FileNameAsString));

                    // convert the image to main and thumb sizes
                    imageService.CreateSizedImages(image, imageDefinitionKeys);

                    File.Delete(imageFileService.GetFullPath(image.FileNameAsString));

                    images.Add(image);
                }
            }

            return images;
        }
        public ClubMemberViewCell()
        {

            nameTGR = new TapGestureRecognizer();
            nameTGR.Tapped += NameTGR_Tapped;

            ch = new ColorHandler();
            iEmoji = new Image
            {
                Aspect = Aspect.AspectFit,
                WidthRequest = 75,
                HorizontalOptions = LayoutOptions.StartAndExpand,
                VerticalOptions = LayoutOptions.Center
            };
            iEmoji.SetBinding(Image.SourceProperty, "Emoji");
            lUsername = new Label
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                VerticalOptions = LayoutOptions.Center
            };
            lUsername.SetBinding(Label.TextProperty, "Username");
            lUsername.SetBinding(Label.TextColorProperty, "UserColor", converter: new ColorConverter());
            lUsername.GestureRecognizers.Add(nameTGR);
            updateView();
        }
Example #3
0
        public Arrow(Keys lastKey, object obj)
        {
            Image = new Image();
            switch (lastKey)
            {
                case Keys.W:
                    Image.Path = "Gameplay/Projectiles/arrow_up";
                    break;
                case Keys.S:
                    Image.Path = "Gameplay/Projectiles/arrow_down";
                    break;
                case Keys.A:
                    Image.Path = "Gameplay/Projectiles/arrow_left";
                    break;
                case Keys.D:
                    Image.Path = "Gameplay/Projectiles/arrow_right";
                    break;
            }

            DirectionKey = lastKey;

            if (obj.GetType() == typeof(Player))
            {
                Player p = (Player)obj;
                Image.Position = p.Image.Position;
            }
            MoveSpeed = 250f;
            Image.Scale = new Vector2(1, 2);
            Image.LoadContent();
        }
Example #4
0
        private void InitializeComponents()
        {
            StackLayout layout = new StackLayout ();

            nameLabel = new Label () {
                Text = client.Name,
                FontSize = 18,
                XAlign = TextAlignment.Center
            };

            layout.Children.Add ( nameLabel );

            profileImage = new Image () {
                Source = client.PictureUrl,
                Aspect = Aspect.AspectFit
            };

            layout.Children.Add ( profileImage );

            phoneLabel = new Label () {
                Text = client.Phone,
                FontSize = 14,
                XAlign = TextAlignment.Center
            };

            layout.Children.Add ( phoneLabel );

            Content = layout;
        }
        public override void LoadContent()
        {
            base.LoadContent();

            Image = new Image();
            Image.Path = "Gameplay/UI/loadingscreenanimation";
            //Image.SourceRect = new Rectangle(0, 0, 400, 100);
            //Image.Position = new Vector2 ((ScreenManager.Instance.GraphicsDevice.Viewport.Width / 2) - 100,
            //	(ScreenManager.Instance.GraphicsDevice.Viewport.Height / 2) - 100);
            Image.LoadContent();

            Image.SourceRect = new Rectangle(0, 0, 100, 100);
            //Image.Position = new Vector2 ((ScreenManager.Instance.GraphicsDevice.Viewport.Width / 2) - 100,
            //	(ScreenManager.Instance.GraphicsDevice.Viewport.Height / 2) - 100);

            Image.IsActive = true;
            Image.ActivateEffect ("SpriteSheetEffect");
            Image.SpriteSheetEffect.IsActive = true;
            /* Turn the fade effect off */
            Image.FadeEffect.IsActive = false;
            /* Make the player face the camera */
            Image.SpriteSheetEffect.SwitchFrame = 250;
            Image.SpriteSheetEffect.AmountOfFrames = new Vector2(4, 1);
            Image.SpriteSheetEffect.DefaultFrame = Vector2.Zero;
            Image.SpriteSheetEffect.CurrentFrame = Image.SpriteSheetEffect.DefaultFrame;

            Image.Position = new Vector2 (Image.Position.X - 50, Image.Position.Y - 50);
        }
Example #6
0
 public Cursor(Image regular, Image clicked)
     : base(new Vector2(Mouse.GetState().X, Mouse.GetState().Y), regular)
 {
     Layer = int.MaxValue;
     Regular = regular; Clicked = clicked;
     Regular.Parallax = new Vector2(); Clicked.Parallax = new Vector2();
 }
		public TodoItemCell ()
		{
			StyleId = "Cell";

			var label = new Label {
				StyleId = "CellLabel",
				YAlign = TextAlignment.Center,
				HorizontalOptions = LayoutOptions.StartAndExpand
			};
			label.SetBinding (Label.TextProperty, "Name");

			var tick = new Image {
				StyleId = "CellTick",
				Source = FileImageSource.FromFile ("check"),
				HorizontalOptions = LayoutOptions.End
			};
			tick.SetBinding (Image.IsVisibleProperty, "Done");

			var layout = new StackLayout {
				Padding = new Thickness(20, 0, 20, 0),
				Orientation = StackOrientation.Horizontal,
				HorizontalOptions = LayoutOptions.FillAndExpand,
				Children = {label, tick}
			};
			View = layout;
		}
		public SessionCell ()
		{
			title = new Label {
				YAlign = TextAlignment.Center
			};
			title.SetBinding (Label.TextProperty, "Title");

			label = new Label {
				YAlign = TextAlignment.Center,
				Font = Font.SystemFontOfSize(10)
			};
			label.SetBinding (Label.TextProperty, "LocationDisplay");

			var fav = new Image {
				Source = FileImageSource.FromFile ("favorite.png"),
			};
			//TODO: implement favorites
			//fav.SetBinding (Image.IsVisibleProperty, "IsFavorite");

			var text = new StackLayout {
				Orientation = StackOrientation.Vertical,
				Padding = new Thickness(0, 0, 0, 0),
				HorizontalOptions = LayoutOptions.StartAndExpand,
				Children = {title, label}
			};

			layout = new StackLayout {
				Padding = new Thickness(20, 0, 0, 0),
				Orientation = StackOrientation.Horizontal,
				HorizontalOptions = LayoutOptions.StartAndExpand,
				Children = {text, fav}
			};
			View = layout;
		}
        public FancyListCell()
        {
            var image = new Image
              {
            HorizontalOptions = LayoutOptions.Start
              };
              image.SetBinding(Image.SourceProperty, new Binding("Icon"));
              image.WidthRequest = image.HeightRequest = 50;

              var nameLabel = new Label
              {
            HorizontalOptions = LayoutOptions.FillAndExpand,
            VerticalOptions = LayoutOptions.Center,
            FontSize = 26,
            TextColor = Color.FromHex("111111")
              };
              nameLabel.SetBinding(Label.TextProperty, "Title");

              var viewLayout = new StackLayout()
              {
            Orientation = StackOrientation.Horizontal,
            Spacing = 10,
            Padding = 15,
            Children = { image, nameLabel }
              };
              View = viewLayout;
        }
Example #10
0
        public void CreateHistogram(Image<Bgr, Byte> img)
        {
            Image<Gray, Byte>[] channels = img.Split();
            Image<Gray, Byte> blueChannel = channels[0];
            Image<Gray, Byte> greenChannel = channels[1];
            Image<Gray, Byte> redChannel = channels[2];

            //Red colour channel
            DenseHistogram dhRed = new DenseHistogram(BIN_SIZE, new RangeF(0.0f, BIN_DEPTH));
            dhRed.Calculate<Byte>(new Image<Gray, Byte>[1] { redChannel }, false, null);
            redChart.ClearHistogram();
            redChart.AddHistogram("Red Channel", System.Drawing.Color.Red, dhRed);
            redChart.Refresh();

            //Green colour Channel
            DenseHistogram dhGreen = new DenseHistogram(BIN_SIZE, new RangeF(0.0f, BIN_DEPTH));
            dhGreen.Calculate<Byte>(new Image<Gray, Byte>[1] { greenChannel }, false, null);
            greenChart.ClearHistogram();
            greenChart.AddHistogram("Green Channel", System.Drawing.Color.Green, dhGreen);

            greenChart.Refresh();

            //Blue colour Channel
            DenseHistogram dhBlue = new DenseHistogram(BIN_SIZE, new RangeF(0.0f, BIN_DEPTH));
            dhBlue.Calculate<Byte>(new Image<Gray, Byte>[1] { blueChannel }, false, null);
            blueChart.ClearHistogram();
            blueChart.Show();
            blueChart.AddHistogram("Blue Channel", System.Drawing.Color.Blue, dhBlue);
            blueChart.Refresh();
        }
 public object Convert(object value, Type targetType, object parameter, string language) {
     if (value != null) {
         var page = (Page)value;
         if (page != null) {
             if (page.Icon == null) {
                 var glyph = (string)page.GetValue(AttachedFontIcon.GlyphProperty);
                 if (!string.IsNullOrWhiteSpace(glyph)) {
                     var familary = (string)page.GetValue(AttachedFontIcon.FontFamilyProperty);
                     //control it's color by theme resource.
                     //var color = (Color)page.GetValue(AttachedFontIcon.ColorProperty);
                     var size = (double)page.GetValue(AttachedFontIcon.FontSizeProperty);
                     var icon = new Windows.UI.Xaml.Controls.FontIcon() {
                         Glyph = glyph,
                         FontFamily = familary.ToFontFamily(),
                         FontSize = size,
                         //Foreground = color.ToBrush()
                     };
                     return icon;
                 }
             } else {
                 var img = new Image();
                 img.Source = page.Icon;
                 return img;
             }
         }
     }
     return null;
 }
Example #12
0
        public override Image Load(System.IO.Stream s)
        {

            if (s.ReadByte() == 255)
            {
                byte[] buf = new byte[s.Length - 1];
                s.Read(buf, 0, buf.Length);
                s = new MemoryStream(Orvid.Compression.LZMA.Decompress(buf));
            }
            else
            {
                s.Position = 0;
            }
            byte[] tmp = new byte[8];
            s.Read(tmp, 0, 8); // skip the 8 empty bytes at the start of the file.
            tmp = new byte[4];
            s.Read(tmp, 0, 4);
            uint Height = ReadUInt32(tmp); // Read the Height.
            s.Read(tmp, 0, 4);
            uint Width = ReadUInt32(tmp); // Read the Width.
            Image i = new Image((int)Width, (int)Height);
            byte r, g, b, a;
            for (uint x = 0; x < Width; x++)
            {
                for (uint y = 0; y < Height; y++)
                {
                    r = (byte)s.ReadByte();
                    g = (byte)s.ReadByte();
                    b = (byte)s.ReadByte();
                    a = (byte)s.ReadByte();
                    i.SetPixel(x, y, new Pixel(r, g, b, a));
                }
            }
            return i;
        }
Example #13
0
        public override void Save(Image i, System.IO.Stream dest)
        {
            MemoryStream m = new MemoryStream();
            m.WriteByte(0);
#warning Change this next byte to 255 if you update Image with UInt64 for width and height.
            m.WriteByte(0);
            m.WriteByte(0);
            m.WriteByte(0); // Write the 8 empty bytes at the start of the file.
            m.WriteByte(0);
            m.WriteByte(0);
            m.WriteByte(0);
            m.WriteByte(0);

            byte[] dat = BitConverter.GetBytes(i.Height); // Write the height.
            m.Write(dat, 0, dat.Length);
            dat = BitConverter.GetBytes(i.Width); // Write the width.
            m.Write(dat, 0, dat.Length);

            // Now to write the actual data.
            Pixel p;
            for (uint x = 0; x < i.Width; x++)
            {
                for (uint y = 0; y < i.Height; y++)
                {
                    p = i.GetPixel(x, y);
                    m.WriteByte(p.R);
                    m.WriteByte(p.G);
                    m.WriteByte(p.B);
                    m.WriteByte(p.A);
                }
            }
            dat = Orvid.Compression.LZMA.Compress(m.GetBuffer());
            dest.WriteByte(255);
            dest.Write(dat, 0, dat.Length);
        }
        public ContentDemo()
        {
            Button button = new Button
            {
                Text = "Edit Profile",
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.CenterAndExpand
            };
            button.Clicked += OnButtonClicked;

            Image myImage = new Image
            {
                Aspect = Aspect.Fill,
                Source = ImageSource.FromUri( new Uri(@"https://4e72eb44013d543eb0c67f8fbddf2ed30743ec8d.googledrive.com/host/0B70CO9lnNPfceHNFLXh2Wm8yMHc/List-Most-Expensive-Cars-photo-OdYL.jpg"))
            };
            this.Title = "Content Page";

            RelativeLayout relativeLayout = new RelativeLayout ();

            relativeLayout.Children.Add (myImage,
                Constraint.Constant (0),
                Constraint.Constant (0),
                Constraint.RelativeToParent ((parent) => { return parent.Width; }),
                Constraint.RelativeToParent ((parent) => { return parent.Height; }));

            relativeLayout.Children.Add (button,
                Constraint.RelativeToParent ((parent) => {return parent.Width/2;} ),
                Constraint.RelativeToParent ((parent) => {return parent.Height/2;} ),
                Constraint.RelativeToParent ((parent) => { return 75.0; }),
                Constraint.RelativeToParent ((parent) => { return 75.0; }));

            Content = relativeLayout;
        }
Example #15
0
        public RangeSliderBubble()
        {
            // Init
            this.BackgroundColor = Color.Transparent;

            // Image
            _image = new Image();

            AbsoluteLayout.SetLayoutFlags(_image, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(_image, new Rectangle(0f, 0f, 1f, 1f));

            _image.SetBinding(Image.SourceProperty, new Binding(path: "Source", source: this));

            this.Children.Add(_image);

            // Label
            _label = new Label() { VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center };

            AbsoluteLayout.SetLayoutFlags(_label, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(_label, new Rectangle(0.5f, 0.7f, 0.8f, 0.6f));

            _label.SetBinding(Label.TextProperty, new Binding(path: "Text", source: this));

            this.Children.Add(_label);
        }
Example #16
0
        public ActionResult Create(Realty realty, IEnumerable<HttpPostedFileBase> newImages)
        {
            if (ModelState.IsValid)
            {
                var curUser = (from u in db.UserProfiles
                               where u.UserName == User.Identity.Name
                               select u).Single();
                if (realty.VideoLink != null)
                    realty.VideoLink = realty.youtubeID(realty.VideoLink);
                realty.Owner = curUser;

                // files stuff
                if (newImages != null && newImages.First() != null)
                {
                    realty.Images = new List<Image>();
                    foreach (var image in newImages)
                    {
                        if (image.ContentLength > 0)
                        {
                            var supportedTypes = new[] { "jpg", "jpeg", "png" };

                            var fileExt = System.IO.Path.GetExtension(image.FileName).Substring(1);

                            if (!supportedTypes.Contains(fileExt))
                            {
                                ModelState.AddModelError("Images", "Invalid type. Only the following types (jpg, jpeg, png) are supported.");
                                return View();
                            }

                            string filetype = image.ContentType;
                            int filelength = image.ContentLength;
                            Stream filestream = image.InputStream;
                            byte[] filedata = new byte[filelength];
                            string filename = Path.GetFileName(image.FileName);
                            filestream.Read(filedata, 0, filelength);

                            var data = new Image
                            {
                                Name = filename,
                                MimeType = filetype,
                                Data = filedata
                            };

                            realty.Images.Add(data);
                        }
                    }
                }
                else
                {
                    ModelState.AddModelError("Images", "You have to upload at least one photo.");
                    return View();
                }

                db.Realties.Add(realty);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(realty);
        }
        private Texture(Image image, string filePath)
        {
            //Data = raw;
            //image.ConvertToDxtc(CompressedDataFormat.DXT5);
            Width = image.Width;
            Height = image.Height;
            Depth = image.Depth;
            PixelWdith = image.BytesPerPixel;

            var imageFormat = image.Format;
            var imageBitPerChannal = image.BitsPerPixel / image.ChannelCount;

            if (imageFormat == DataFormat.BGR && imageBitPerChannal == 8)
            {
                ColorFormat = Format.B8G8R8X8_UNorm;
            }
            else if (imageFormat == DataFormat.BGRA && imageBitPerChannal == 8)
            {
                ColorFormat = Format.B8G8R8A8_UNorm;
            }
            else if (imageFormat == DataFormat.RGB && imageBitPerChannal == 8)
            {
                ColorFormat = Format.R8G8B8A8_UNorm;
            }
            else if (imageFormat == DataFormat.RGBA && imageBitPerChannal == 8)
            {
                ColorFormat = Format.R8G8B8A8_UNorm;
            }
            else if (imageFormat == DataFormat.RGBA && imageBitPerChannal == 16)
            {
                ColorFormat = Format.R16G16B16A16_UNorm;
            }

            Data = image.GetImageData(0).Data;
        }
Example #18
0
		public void TestImplicitFileConversion ()
		{
			var image = new Image { Source = "File.png" };
			Assert.IsTrue (image.Source != null);
			Assert.That (image.Source, Is.InstanceOf<FileImageSource> ());
			Assert.AreEqual ("File.png", ((FileImageSource)(image.Source)).File);
		}
        public ImagePreviewViewModel BuildPreview(Image image)
        {
            if (image == null)
            {
                throw new ArgumentNullException("image");
            }

            var result = new ImagePreviewViewModel();
            result.Name = image.Name;
            result.Description = image.Description;
            result.Key = image.Key;
            try
            {
                result.Content = string.Format(
                    "data:{0};base64,{1}",
                    image.ContentType,
                    this.GetImageContent(image));
            }
            catch (Exception)
            {
                result.Content = string.Empty;
            }

            return result;
        }
Example #20
0
		public void TestImplicitStringUriConversion ()
		{
			var image = new Image { Source = "http://xamarin.com/img.png" };
			Assert.IsTrue (image.Source != null);
			Assert.That (image.Source, Is.InstanceOf<UriImageSource> ());
			Assert.AreEqual ("http://xamarin.com/img.png", ((UriImageSource)(image.Source)).Uri.AbsoluteUri);
		}
Example #21
0
        public ProductImagePage(ImageSource productImageSource)
        {
            Padding = Device.OnPlatform(new Thickness(0, 20, 0, 0), new Thickness(0), new Thickness(0));
            _productImageSource = productImageSource;
            BackgroundColor = Color.FromRgba(0, 0, 0, 127);

            var absoluteLayout = new AbsoluteLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand
            };
            var closeButtom = new Button
            {
                WidthRequest = 50,
                Image = "backspace.png",
                BackgroundColor = Color.Transparent
            };
            closeButtom.Clicked += OnCloseButtonClicked;
            var image = new Image
            {
                Source = _productImageSource
            };
            AbsoluteLayout.SetLayoutFlags(closeButtom, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds(closeButtom, new Rectangle(1f, 0f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
            AbsoluteLayout.SetLayoutFlags(image, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds(image, new Rectangle(0.5f, 0.5f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
            absoluteLayout.Children.Add(image); 
            absoluteLayout.Children.Add(closeButtom);

            Content = absoluteLayout;
        }
		public LoadingPlaceholder ()
		{
			Padding = new Thickness (20);
			Title = "Image Loading Gallery";

			var source = new UriImageSource {
				Uri = new Uri ("http://www.nasa.gov/sites/default/files/styles/1600x1200_autoletterbox/public/images/298773main_EC02-0282-3_full.jpg"),
				CachingEnabled = false
			};

			var image = new Image {
				Source = source,
				WidthRequest = 200,
				HeightRequest = 200,
			};

			var indicator = new ActivityIndicator {Color = new Color (.5),};
			indicator.SetBinding (ActivityIndicator.IsRunningProperty, "IsLoading");
			indicator.BindingContext = image;

			var grid = new Grid();
			grid.RowDefinitions.Add (new RowDefinition());


			grid.Children.Add (image);
			grid.Children.Add (indicator);


			Content = grid;
		}
Example #23
0
        public AcercaDePage() {
            Title = "Acerca de";
            Icon = "info.png";
            
            BackgroundImage = "background.png";
            StackLayout panel = new StackLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Orientation= StackOrientation.Vertical,
                Spacing = 15,
                Padding = new Thickness(20, Device.OnPlatform(40, 20, 20), 20, 20),
            };

            panel.Children.Add(new Label { 
                Text ="Aplicación desarrollada por:",
                TextColor = Color.Black,
            });

            var imagen = new Image
            {
                HorizontalOptions = LayoutOptions.Center,
            };

            imagen.Source = ImageSource.FromFile("csharp.jpeg");
            panel.Children.Add(imagen);

            panel.Children.Add(new Label
            {
                Text = "Rafael Cárdenas",
                TextColor = Color.Black,
            });

            Content = panel;
        }
        //View
        public DownloadImageDemoPage()
        {
            var heading = new Label
            {
                Text = "Download Image",
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.StartAndExpand,
                FontSize = 50,
                FontAttributes = FontAttributes.Bold | FontAttributes.Italic
            };

            var webImage = new Image
            {
                Source = ImageSource.FromUri(new Uri
                    ("https://xamarin.com/content/images/pages/branding/assets/xamarin-logo.png")),
                VerticalOptions = LayoutOptions.CenterAndExpand
            };

            var mainLayout = new StackLayout
            {
                HorizontalOptions = LayoutOptions.Center,
                Children =
                {
                    heading,
                    webImage
                }
            };

            Content = mainLayout;
        }
		public ListOfBeerCell2 ()
		{
			var preBlank = new Label {
				Text = "",
				FontSize = 11
			};

			var image = new Image
			{
				Aspect = Aspect.AspectFill,
				//WidthRequest = 150,

				HorizontalOptions = LayoutOptions.Start,
				VerticalOptions = LayoutOptions.Center
			};
			image.SetBinding(Image.SourceProperty, new Binding("ProName"));

			var rslayout = CreateRightSideLayout ();

			var ctrlayout = CreateMiddleLayout ();

			var ctrrghtlayout = CreateMiddleRightLayout ();

			var leftImageLayout = new StackLayout()
			{
				Spacing = 2,
				Padding = new Thickness (5, 5, 0, 5),
				VerticalOptions = LayoutOptions.Center,
				Orientation = StackOrientation.Horizontal,
				Children = {image, ctrlayout, ctrrghtlayout, rslayout}
			};
			View = leftImageLayout;
		}
Example #26
0
        public LearningPathViewModel(/*ICommand renderXnaCmd, */DatabaseService db, ICommand returnToMainWindowCmd)
        {
            ReturnToMainWindowCmd = returnToMainWindowCmd;

            MDetector md = new MDetector();
            Image<Bgr, Byte> img = new Image<Bgr, Byte>(640, 480, new Bgr(255, 255, 0));
            PiktoViewDB piktodb = new PiktoViewDB(db);
            pictoViewManager = new PiktoViewManager(piktodb);
            ToolArtNetwork toolNetwork = new ToolArtNetwork(piktodb.getImageIdDic());
            MarkerPosition3D pos = new MarkerPosition3D(80.0f, 640.0f, 640, 480);

            RenderXnaCmd = new BasicCommand(p =>
            {
                md.findMarkers(img.Convert<Gray, Byte>());
                if (md.isMarker())
                {
                    int id = toolNetwork.recognitionPictograms(md.markers[0].getSymbolImage());
                    if (id != -1)
                    {
                        pos.estimate(md.markers[0]);
                        pictoViewManager.viewSceneMarker(id, pos.getTransformatinMatrix(), img.ToBitmap());
                    }
                }
                else
                {
                    pictoViewManager.updateDisplayCameraLayer(img.ToBitmap());
                }
                displayComponent.displaySetContent();
            });
        }
Example #27
0
        public static Image<Gray, float> Compute(OpticalFlowModel model)
        {
            var flowX = new Image<Gray, float>(model.Image1.Size);
            var flowY = new Image<Gray, float>(model.Image1.Size);

            Emgu.CV.OpticalFlow.Farneback(
                model.Image1,
                model.Image2,
                flowX,
                flowY,
                model.PyramidScale,
                model.Levels,
                model.WindowSize,
                model.Iterations,
                model.PolyN,
                model.PolySigma,
                model.Flag);

            flowY = flowY.Mul(flowY);
            flowX = flowX.Mul(flowX);
            Image<Gray, float> flowResult = flowX.Mul(flowX) + flowY.Mul(flowY);
            CvInvoke.cvSqrt(flowResult, flowResult);

            return flowResult;
        }
        public ModuleButton(string title, string backgroundImageSource)
        {
            Label titleLabel = new Label {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions = LayoutOptions.Fill,
                BackgroundColor = Color.FromRgba(255, 255, 255, 100),
                TextColor = Color.White,
                Text = title,
                FontSize = 14,

            };

            Image backgroundImage = new Image {
                Source = backgroundImageSource,
                Aspect = Aspect.AspectFill,
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions = LayoutOptions.Fill
            };

            RelativeLayout layout = new RelativeLayout ();

            layout.Children.Add (titleLabel,
                Constraint.Constant (0),
                Constraint.Constant (0),
                Constraint.RelativeToParent ((parent) => parent.Width),
                Constraint.RelativeToParent ((parent) => parent.Height));
            layout.Children.Add (backgroundImage,
                Constraint.Constant (0),
                Constraint.Constant (0),
                Constraint.RelativeToParent ((parent) => parent.Width),
                Constraint.RelativeToParent ((parent) => parent.Height));

            Content = layout;
        }
		public ListItemTemplate ()
		{
			var photo = new Image { HeightRequest = 44, WidthRequest = 44 };
			photo.SetBinding (Image.SourceProperty, "Photo");

			var nameLabel = new Label { 
				VerticalTextAlignment = TextAlignment.Center,
				FontAttributes = FontAttributes.None,
				FontSize = Device.GetNamedSize (NamedSize.Medium, typeof(Label)),
			};

			nameLabel.SetBinding (Label.TextProperty, "Name");

			var titleLabel = new Label { 
				VerticalTextAlignment = TextAlignment.Center,
				FontAttributes = FontAttributes.None,
				FontSize = Device.GetNamedSize (NamedSize.Micro, typeof(Label)),
			};

			titleLabel.SetBinding (Label.TextProperty, "Title");

			var information = new StackLayout {
				Padding = new Thickness (5, 0, 0, 0),
				VerticalOptions = LayoutOptions.StartAndExpand,
				Orientation = StackOrientation.Vertical,
				Children = { nameLabel, titleLabel }
			};

			View = new StackLayout {
				Orientation = StackOrientation.Horizontal,
				Children = { photo, information }
			};
		}
        public async Task<IHttpActionResult> PostImage(Image image)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            image.Id = Guid.NewGuid();
            db.Images.Add(image);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (ImageExists(image.Id))
                {
                    return Conflict();
                }
                else
                {
                    throw;
                }
            }

            return CreatedAtRoute("DefaultApi", new { id = image.Id }, image);
        }