Exemplo n.º 1
0
        public async Task TestStylize()
        {
            StylizeGraph stylizeGraph = new StylizeGraph();
            await stylizeGraph.Init();

            Tensor image         = ImageIO.ReadTensorFromImageFile <float>("surfers.jpg");
            Tensor stylizedImage = stylizeGraph.Stylize(image, 0);
        }
Exemplo n.º 2
0
        public override void OnButtonClicked(Object sender, EventArgs args)
        {
            base.OnButtonClicked(sender, args);

            if (_buttonMode == ButtonMode.WaitingModelDownload)
            {
                _stylizeGraph.Init();
            }
            else
            {
                LoadImages(new string[] { "surfers.jpg" });
            }
        }
Exemplo n.º 3
0
        partial void stylizeClicked(NSObject sender)
        {
            SetMessage("Please wait while we download Stylize model from internet...");
            SetImage(null);

            if (_stylizeGraph == null)
            {
                _stylizeGraph = new StylizeGraph();
                _stylizeGraph.OnDownloadProgressChanged += OnDownloadProgressChanged;
                _stylizeGraph.OnDownloadCompleted       += stylizeGraph_OnDownloadCompleted;
            }
            _stylizeGraph.Init();
        }
Exemplo n.º 4
0
        async void stylizeClicked(NSObject sender)
        {
            SetMessage("Please wait while we download Stylize model from internet...");
            SetImage(null);

            if (_stylizeGraph == null)
            {
                _stylizeGraph = new StylizeGraph();
                _stylizeGraph.OnDownloadProgressChanged += OnDownloadProgressChanged;
                //_stylizeGraph.OnDownloadCompleted += stylizeGraph_OnDownloadCompleted;
            }
            await _stylizeGraph.Init();

            SetMessage("");

            byte[] jpeg = _stylizeGraph.StylizeToJpeg("surfers.jpg", 0);
            using (System.IO.Stream s = new System.IO.MemoryStream(jpeg))
            {
                NSImage newImg = NSImage.FromStream(s);
                SetImage(newImg);
            }
        }