Exemplo n.º 1
0
        MseService(int port)
        {
            Mse = cs_zkrobot.zkRobot_Factory.getRobotMse(Utility.Mse.xmpp_domain());

            // 使用 3300 端口

            Mse.reg_service("mse_s_000000000000_" + ServiceType + "_0", "", ServiceType, "http://" + Utility.Mse.getip() + ":" + port.ToString(), handler, null);
        }
Exemplo n.º 2
0
        public override ActionResult Compare()
        {
            var mseCalc = new Mse();

            if (string.IsNullOrEmpty(this.HttpContext.Session.Get <string>(Image1)) || string.IsNullOrEmpty(this.HttpContext.Session.Get <string>(Image2)))
            {
                var obj = new { info = "Error", value = "Before comparing please input two images." };
                return(Json(obj));
            }
            else
            {
                var          image1 = (Bitmap)Bitmap.FromFile(this.HttpContext.Session.Get <string>(Image1));
                var          image2 = (Bitmap)Bitmap.FromFile(this.HttpContext.Session.Get <string>(Image2));
                AssessResult result;
                try
                {
                    result = mseCalc.Assess(image1, image2, UseComponent.Luma | UseComponent.Cb | UseComponent.Cr);
                }
                catch (ArgumentException e)
                {
                    var obj = new { info = "Error", value = e.Message };
                    return(Json(obj));
                }
                var mse = (result.Luma + result.Cb + result.Cr) / 3;
                if (mse.Equals(0.0))
                {
                    var obj = new { info = "Same", value = "These two images are exactly the same. MSE value is <Strong>Zero</Strong>." };
                    return(Json(obj));
                }
                else
                {
                    var obj = new { info = "Different", value = "MSE value of these two images is <Strong>" + mse.ToString() + "</Strong>." };
                    return(Json(obj));
                }
            }
        }