Example #1
0
        private void cmbType_SelectedIndexChanged(object sender, EventArgs e)
        {
            tmrPlay.Enabled = false;
            lblNotice.Text  = "";
            btnImgPlay.Text = "Play";

            cmbAlg.Items.Clear();

            DetectionAlg[] algs = typeToAlg[cmbType.SelectedIndex];
            if (algs.Length > 0)
            {
                for (int i = 0; i < algs.Length; i++)
                {
                    cmbAlg.Items.Add(DetectionDesc.Alg(algs[i]));
                }
                cmbAlg.SelectedIndex = -1;
            }
            else
            {
                cmbAlg.Items.Add("No Algs Found");
                cmbAlg.SelectedIndex = 0;
            }

            curImgList = typeToImgList[cmbType.SelectedIndex];
            imgIndex   = 0;

            imgMain.Image   = ImgList.GetImageFromPath("UI\\PickAAlg.jpg");
            lblWarning.Text = "";
        }
Example #2
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            //获取字段
            int    nei  = Convert.ToInt32(context.Request["nei"]);
            var    file = context.Request.Files[0];
            string path = "/Admin/Img/News/" + Guid.NewGuid().ToString().ToLower() + ".jpg";

            file.SaveAs(context.Server.MapPath(path));
            //创建实体
            ImgList imglist = new ImgList()
            {
                IngUrl   = path,
                IsDelete = false,
                NewsID   = nei
            };
            var db = MyContext.Create();

            //添加
            db.ImgList.Add(imglist);
            //改变状态
            int row = db.SaveChanges();

            if (row > 0)
            {
                context.Response.Redirect("/Admin/Page/ImgListManager.aspx");
            }
        }
Example #3
0
        protected override void Execute(CodeActivityContext context)
        {
            MimeMessage   mimeMessage   = MimeMessage.Get(context);
            List <string> imgList       = new List <string>();
            List <string> imgSourceList = new List <string>();
            string        imgFolder     = ImgFolder.Get(context);

            string htmlBody = null;
            IEnumerable <MimeEntity> bodys;

            try
            {
                if (!Directory.Exists(imgFolder) && imgFolder != null && imgFolder != "")
                {
                    Directory.CreateDirectory(imgFolder);
                }

                htmlBody = mimeMessage.HtmlBody;
                ParseHtmlbody(imgFolder, htmlBody, ref imgList, ref imgSourceList);

                bodys = mimeMessage.BodyParts;
                ParseBodyParts(bodys, imgFolder, ref imgList, ref imgSourceList);
                ImgList.Set(context, imgList.ToArray());
                if (imgSourceList != null)
                {
                    ImgSourceList.Set(context, imgSourceList.ToArray());
                }
            }
            catch (Exception e)
            {
                SharedObject.Instance.Output(SharedObject.enOutputType.Error, "获取邮件图片失败", e.Message);
            }
        }
Example #4
0
        public void LoadImages(bool loadCustomIcons)
        {
            ImgList.Clear();
            keyFileDict.Clear();

            ImgList.Add("default", defImage);

            foreach (KeyValuePair <string, Pixbuf> image in defaultImages)
            {
                ImgList.Add(image.Key, image.Value);
            }

            if (Directory.Exists("icons") && loadCustomIcons)
            {
                foreach (string f in Directory.GetFiles("icons"))
                {
                    using (Pixbuf img = new Pixbuf(f))
                    {
                        string imgKey = Path.GetFileNameWithoutExtension(f);
                        if (ImgList.ContainsKey(imgKey))
                        {
                            ImgList.Remove(imgKey);
                        }
                        keyFileDict[imgKey] = f;
                        ImgList.Add(imgKey, img);
                    }
                }
            }
        }
Example #5
0
 private void DeleteHandler(int?item)
 {
     if (item >= 0)
     {
         ImgList.RemoveAt((int)item);
     }
 }
Example #6
0
        /// <summary>
        /// Check if the folder path of input filename exists in the list
        /// </summary>
        /// <param name="filename"></param>
        /// <returns></returns>
        public bool ContainsDirPathOf(string filename)
        {
            var target = Path.GetDirectoryName(filename).ToUpperInvariant();

            var index = ImgList.FindIndex(item => Path.GetDirectoryName(item.Filename).ToUpperInvariant() == target);

            return(index != -1);
        }
Example #7
0
        private void BinarizationImageHandler(string src)
        {
            var test = (SampleImage)SelectedImageA.Clone();

            test.Description = src;
            OpenCV.Binarisation(test.ImageMat);
            test.Update();
            ImgList.Add(test);
        }
Example #8
0
        private void ClaheImageHandler(string src)
        {
            var test = (SampleImage)SelectedImageA.Clone();

            test.Description = src;
            OpenCV.HistoEqui(test.ImageMat);
            test.Update();
            ImgList.Add(test);
        }
Example #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CloudStorageAccount csa    = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("AzureStorageCS"));
            CloudBlobClient     client = csa.CreateCloudBlobClient();

            container = client.GetContainerReference("photobucket");
            container.CreateIfNotExists();
            container.SetPermissions(new BlobContainerPermissions {
                PublicAccess = BlobContainerPublicAccessType.Blob
            });
            ImgList.DataSource = container.ListBlobs();
            ImgList.DataBind();
        }
Example #10
0
        /// <summary>
        /// The ImageBooster Factory
        /// </summary>
        /// <param name="filenames">List of filenames</param>
        public Factory(IList <string> filenames)
        {
            // import filenames to the list
            foreach (var filename in filenames)
            {
                ImgList.Add(new Img(filename));
            }

            // start background service worker
            IsRunWorker = true;
            var _bw = new BackgroundWorker();

            _bw.RunWorkerAsync(StartImageBoosterAsync());
        }
Example #11
0
 public Pixbuf this[string key]
 {
     get
     {
         if (ImgList.ContainsKey(key))
         {
             return(ImgList[key]);
         }
         else
         {
             return(defImage);
         }
     }
 }
Example #12
0
        public PartialViewResult Upload()
        {
            try
            {
                string serverFolder = Server.MapPath("~/Media");
                if (!Directory.Exists(serverFolder))
                {
                    Directory.CreateDirectory(serverFolder);
                }

                if (Request.Files.Count > 0)
                {
                    for (int i = 0; i < Request.Files.Count; i++)
                    {
                        HttpPostedFileBase file = Request.Files[i];
                        file.SaveAs(serverFolder + "\\" + file.FileName);
                        ImgList.Add(new Models.Image()
                        {
                            ImageUrl = "/Media/" + file.FileName, Name = file.FileName
                        });
                    }
                    ViewBag.Message = "Files uploaded successfully.";
                }
                else
                {
                    ViewBag.Message = "No files.";
                }


                return(PartialView("_FileUpload", ImgList));
            }
            catch (Exception ex)
            {
                WebsiteExceptions websiteExceptions = new WebsiteExceptions();
                _context.WebsiteExceptions.Add(new WebsiteExceptions {
                    Source = ex.Source, Message = ex.Message, InnerException = ex.InnerException.Message, TargetSite = ex.TargetSite.Name
                });
                _context.SaveChanges();
                ViewBag.Message = "File upload not successful, Exception: " + ex.Message + "\n Inner Exception" + ex.InnerException.Message + "\nSource: " + ex.Source;
                return(PartialView("Error"));
            }
        }
Example #13
0
        /// <summary>
        /// Update cached images
        /// </summary>
        public void UpdateCache()
        {
            // clear current queue list
            QueuedList.Clear();

            var cachedIndexList = ImgList
                                  .Select((item, index) => new { ImgItem = item, Index = index })
                                  .Where(item => item.ImgItem.IsDone)
                                  .Select(item => item.Index)
                                  .ToList();

            // release the cachced images
            foreach (var index in cachedIndexList)
            {
                ImgList[index].Dispose();
            }

            // add to queue list
            QueuedList.AddRange(cachedIndexList);
        }
Example #14
0
 /// <summary>
 /// Add a filename to the list
 /// </summary>
 /// <param name="filename">Image filename</param>
 public void Add(string filename)
 {
     ImgList.Add(new Img(filename));
 }
 private void refreshList()
 {
     ImgList.ClearValue(ItemsControl.ItemsSourceProperty);
     ImgList.ItemsSource = ItemList;
 }
Example #16
0
 public void AddThumbnailUrl(string baseUrl, string thumbnailUrl)
 {
     ImgList.Add(new KeyValuePair <string, string>(baseUrl, thumbnailUrl));
 }
Example #17
0
 private void OpenImageHandler(string src)
 {
     ImgList.Add(new SampleImage());
 }
Example #18
0
 /// <summary>
 /// Empty and release resource of the list
 /// </summary>
 public void Clear()
 {
     // release the resources of the img list
     ClearCache();
     ImgList.Clear();
 }
Example #19
0
        //--------------------------------------------------------
        #endregion


        #region Form Events
        //--------------------------------------------------------
        private void Form2_Load(object sender, EventArgs e)
        {
            lblLoading.Visible = false;

            typeToAlg = new DetectionAlg[NUM_DET_TYPES][];
            typeToAlg[(int)DetectionType.PEDESTRIAN] = new DetectionAlg[] {
                DetectionAlg.PED_HOG
            };

            typeToAlg[(int)DetectionType.STOP] = new DetectionAlg[] {
                DetectionAlg.STOPSIGN_SURF,
                DetectionAlg.STOPSIGN_INT_IMG,
                DetectionAlg.STOPSIGN_OCT,
            };

            typeToAlg[(int)DetectionType.WARNING] = new DetectionAlg[] {
                DetectionAlg.WARN_OSURF,
                DetectionAlg.WARN_SURF,
            };

            for (int i = 0; i < NUM_DET_TYPES; i++)
            {
                cmbType.Items.Add(DetectionDesc.Type((DetectionType)i));
            }

            cmbType.SelectedIndex = -1;

            typeToImgList = new ImgList[NUM_DET_TYPES];
            for (int i = 0; i < NUM_DET_TYPES; i++)
            {
                typeToImgList[i] = new ImgList((DetectionType)i);
            }
            imgIndex   = 0;
            curImgList = null;

            algToDetector = new Dictionary <DetectionAlg, Detector>()
            {
                { DetectionAlg.PED_HOG, new HogPedestrianDetector() },
                { DetectionAlg.STOPSIGN_INT_IMG, new IntegralImageStopSignDetector() },
                { DetectionAlg.STOPSIGN_OCT, new OctagonStopSignDetector() },
                { DetectionAlg.STOPSIGN_SURF, new SurfStopSignDetector() },
                { DetectionAlg.WARN_OSURF, new OrientedSurfWarningSignDetector() },
                { DetectionAlg.WARN_SURF, new SurfWarningSignDetector() },
            };

            algToPrecision = new Dictionary <DetectionAlg, double>()
            {
                { DetectionAlg.PED_HOG, -1 },
                { DetectionAlg.STOPSIGN_INT_IMG, 35 / 52d },
                { DetectionAlg.STOPSIGN_OCT, -1 },
                { DetectionAlg.STOPSIGN_SURF, 9 / 52d },
                { DetectionAlg.WARN_OSURF, 38 / 61d },
                { DetectionAlg.WARN_SURF, 26 / 61d }
            };

            imgMain.Image = ImgList.GetImageFromPath("UI\\PickAType.jpg");

            curStats         = new Stats();
            prevStats        = curStats;
            calcStatProgress = 0;
            firstStatRun     = true;
            statThread       = null;
            statThreadKill   = false;
            btnFocus.Focus();
        }
Example #20
0
 /// <summary>
 /// Find index with the given filename
 /// </summary>
 /// <param name="filename">Image filename</param>
 /// <returns></returns>
 public int IndexOf(string filename)
 {
     // case sensitivity, esp. if filename passed on command line
     return(ImgList.FindIndex(item => string.Equals(item.Filename, filename, StringComparison.InvariantCultureIgnoreCase)));
 }
Example #21
0
 /// <summary>
 /// Remove an item in the list with the given index
 /// </summary>
 /// <param name="index"></param>
 public void Remove(int index)
 {
     Unload(index);
     ImgList.RemoveAt(index);
 }
Example #22
0
 public bool IsImgActive(int imgId)
 {
     return(ImgList.FirstOrDefault().Id == imgId);
 }