Ejemplo 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();
        }
Ejemplo n.º 2
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>");
            }
        }
Ejemplo n.º 3
0
        public void ReCalShape()
        {
            double[] m_hu = new double[7];

            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);
                myImage.GetShapeFeature(ref m_hu);

                Image_Shape imgShp = GetSingleImgShp((int)img.ShapeID);
                imgShp.s1 = m_hu[0];
                imgShp.s2 = m_hu[1];
                imgShp.s3 = m_hu[2];
                imgShp.s4 = m_hu[3];
                imgShp.s5 = m_hu[4];
                imgShp.s6 = m_hu[5];
                imgShp.s7 = m_hu[6];
            }
            ImageData.SubmitChanges();
        }
Ejemplo n.º 4
0
 partial void DeleteImage_Shape(Image_Shape instance);
Ejemplo n.º 5
0
 partial void UpdateImage_Shape(Image_Shape instance);
Ejemplo n.º 6
0
 partial void InsertImage_Shape(Image_Shape instance);
Ejemplo 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();
        }
Ejemplo n.º 8
0
        public Image_Shape GetSingleImgShp(int shpId)
        {
            Image_Shape imgShp = ImageData.Image_Shape.Single(c => c.ID == shpId);

            return(imgShp);
        }