Esempio n. 1
0
        public void DeleteImage(int id)
        {
            Image_Info  img    = GetSingleImgInfo(id);
            Image_Color imgClr = GetSingleImgClr(Convert.ToInt32(img.ColorID));
            Image_Shape imgShp = GetSingleImgShp(Convert.ToInt32(img.ShapeID));

            ImageData.Image_Info.DeleteOnSubmit(img);
            ImageData.Image_Color.DeleteOnSubmit(imgClr);
            ImageData.Image_Shape.DeleteOnSubmit(imgShp);

            ImageData.SubmitChanges();
        }
Esempio n. 2
0
        public void ReCalColor()
        {
            const int num = 128;

            var imgInfo = GetAllInfo();

            foreach (Image_Info img in imgInfo)
            {
                //使用原图片
                //ImageProc myImage = new ImageProc(System.Web.HttpContext.Current.Server.MapPath("~/image_repository/") + img.Url);
                //使用标记处理过的图片
                ImageProc myImage  = new ImageProc(HttpContext.Current.Server.MapPath("~/image/roi/") + img.Url);
                int[]     hist_hsv = new int[num];
                myImage.GetHSVHistogram(hist_hsv);
                string str_hsv = GetCharaStr(hist_hsv, num);

                Image_Color imgClr = GetSingleImgClr((int)img.ColorID);
                imgClr.HSV = str_hsv;
            }
            ImageData.SubmitChanges();
        }
Esempio n. 3
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string name     = name_box.Text;
            string category = category_box.Text;
            string period   = period_box.Text;
            string museum   = museum_box.Text;
            string intro    = intro_box.Text;

            System.Diagnostics.Debug.Write(Session["path"]);
            const int num = 128;
            //计算图像中已标定的文物目标的特征值
            ImageProc roiImg = new ImageProc(Session["path"].ToString());

            int[] hist_hsv = new int[num];
            roiImg.GetHSVHistogram(hist_hsv);
            //string str_hsv = GetCharaStr(hist_hsv, num);    //color descriptor
            Image_Color newColor = new Image_Color();

            System.Diagnostics.Debug.Write(hist_hsv);
            double[] shape_hu = new double[7];
            roiImg.GetShapeFeature(ref shape_hu);     //Shape descriptor
            Image_Shape newShape = new Image_Shape();

            System.Diagnostics.Debug.Write(shape_hu);
            SqlServerDataBase sdb = new SqlServerDataBase();

            string stroresqlstring = "insert into Image_info(Url,Tag,Intro,category,Museum,Period) values ('" + Image1.ImageUrl + "','" + name + "','" + intro + "','" + category + "','" + museum + "','" + period + "')";
            bool   stroeFlag       = sdb.Insert(stroresqlstring, null);

            if (stroeFlag == true)
            {
                Response.Write("<script>alert('保存成功!');</script>");
            }
            else
            {
                Response.Write("<script>alert(\"" + sdb.ErrorMessage + "\");</script>");
            }
        }
Esempio n. 4
0
 partial void DeleteImage_Color(Image_Color instance);
Esempio n. 5
0
 partial void UpdateImage_Color(Image_Color instance);
Esempio n. 6
0
 partial void InsertImage_Color(Image_Color instance);
Esempio n. 7
0
        //Insert one image record into database
        public void InsertImage(string tag, int caid, int pid, int mid, string intro, string id)
        {
            const int num = 128;

            Image_Info newImg = new Image_Info();

            newImg.ID         = GetNewId();
            newImg.Tag        = tag;
            newImg.CategoryID = caid;
            newImg.PeriodID   = pid;
            newImg.MuseumID   = mid;
            newImg.Intro      = intro;
            newImg.Url        = id;

            ImageProc myImage = new ImageProc(System.Web.HttpContext.Current.Server.MapPath("~/image/temp/") + id);

            myImage.SaveImage(System.Web.HttpContext.Current.Server.MapPath("~/image/repo/") + id);
            myImage.SaveMiniImage(System.Web.HttpContext.Current.Server.MapPath("~/image/repo/mini/") + id, 200);

            //计算图像中已标定的文物目标的特征值
            ImageProc roiImg = new ImageProc(System.Web.HttpContext.Current.Server.MapPath("~/image/roi/") + id);

            int[] hist_hsv = new int[num];
            roiImg.GetHSVHistogram(hist_hsv);
            string      str_hsv  = GetCharaStr(hist_hsv, num); //color descriptor
            Image_Color newColor = new Image_Color();

            double[] shape_hu = new double[7];
            roiImg.GetShapeFeature(ref shape_hu);     //Shape descriptor
            Image_Shape newShape = new Image_Shape();


            int newId;

            if (ImageData.Image_Color.Count() == 0)
            {
                newId = 0;
            }
            else
            {
                newId = ImageData.Image_Color.Max(cid => cid.ID) + 1;
            }

            newColor.ID    = newId;
            newImg.ColorID = newId;
            newColor.HSV   = str_hsv;

            newShape.ID    = newId;
            newImg.ShapeID = newId;
            newShape.s1    = shape_hu[0];
            newShape.s2    = shape_hu[1];
            newShape.s3    = shape_hu[2];
            newShape.s4    = shape_hu[3];
            newShape.s5    = shape_hu[4];
            newShape.s6    = shape_hu[5];
            newShape.s7    = shape_hu[6];

            ImageData.Image_Shape.InsertOnSubmit(newShape);
            ImageData.Image_Color.InsertOnSubmit(newColor);
            ImageData.Image_Info.InsertOnSubmit(newImg);
            ImageData.SubmitChanges();
        }
Esempio n. 8
0
        public Image_Color GetSingleImgClr(int clrId)
        {
            Image_Color imgClr = ImageData.Image_Color.Single(c => c.ID == clrId);

            return(imgClr);
        }