示例#1
0
        //student view image or upload image
        public ActionResult ResonpeRequest(int StudentID, int requestID, IEnumerable <HttpPostedFileBase> ImageFiles)
        {
            ViewBag.RequestID = requestID;
            ViewBag.StudentID = StudentID;
            var student = StuBO.GetStudentByID(StudentID);

            ViewBag.StudentCode = student.StudentCode;
            ViewBag.StudentName = student.FullName;

            List <RecognizerResult> Results = new List <RecognizerResult>();

            foreach (HttpPostedFileBase file in ImageFiles)
            {
                //Save file anh xuong
                String OldPath = Server.MapPath("~/Content/Temp/" + file.FileName);
                file.SaveAs(OldPath);

                //Resize file anh
                String NewPath = Server.MapPath("~/Content/Temp/Resized/" + file.FileName);
                FaceBusiness.ResizeImage(OldPath, NewPath);

                //Nhan dien khuon mat, cho vao danh sach
                RecognizerResult SingleResult = FaceBusiness.DetectFromImage(NewPath);
                Results.Add(SingleResult);
            }
            return(View("StudentImageResult", Results));
        }
示例#2
0
        public ActionResult AddImages(IEnumerable <HttpPostedFileBase> ImageFiles)
        {
            List <RecognizerResult> Results = new List <RecognizerResult>();

            foreach (HttpPostedFileBase file in ImageFiles)
            {
                //Save file anh xuong
                String OldPath = Server.MapPath("~/Content/Temp/" + file.FileName);
                file.SaveAs(OldPath);

                //Resize file anh
                String NewPath = Server.MapPath("~/Content/Temp/Resized/" + file.FileName);
                FaceBusiness.ResizeImage(OldPath, NewPath);

                //Nhan dien khuon mat, cho vao danh sach
                RecognizerResult SingleResult = FaceBusiness.DetectFromImage(NewPath);
                Results.Add(SingleResult);
            }

            //Load may cai selectbox vao day
            var Students = StuBO.GetActiveStudents();

            ViewBag.Students = Students;

            return(View("AddImagesResult", Results));
        }