public ActionResult ProcessImages()
        {
            ImageProcessionDataViewModel model = new ImageProcessionDataViewModel()
            {
                SelectedPictureName  = MyConstants.NO_PICTURE_PATH_AND_NAME,
                GrayStylePictureName = MyConstants.NO_PICTURE_PATH_AND_NAME,
                HistogramName        = MyConstants.NO_PICTURE_PATH_AND_NAME,
            };

            return(View(model));
        }
        public ActionResult Submit(HttpPostedFileBase file)
        {
            Now = DateTime.Now;
            if (file != null)
            {
                var ext = Path.GetExtension(file.FileName);
                if (allowedFileExtensions.Contains(ext.Substring(1).ToLower()))
                {
                    var selectedFileName             = Path.GetFileNameWithoutExtension(file.FileName);
                    var fullPath                     = Server.MapPath(MyConstants.SELECTED_PICTURE_SAVE_PATH);
                    var selectedFileFullPathPlusName = fullPath + selectedFileName + ext;
                    CreateDirectoryIfDontExist(fullPath);
                    DeleteFileIfExist(selectedFileFullPathPlusName);
                    file.SaveAs(selectedFileFullPathPlusName);

                    Bitmap bitMapPicture = new Bitmap(selectedFileFullPathPlusName);
                    ResizeColorMatrix(bitMapPicture.Height, bitMapPicture.Width);
                    //creates gray style picture and saves it
                    string grayStyleImageFullNameAndPath = Server.MapPath(MyConstants.SELECTED_PICTURE_SAVE_PATH_GRAYSTYLE) + selectedFileName + "-grayStyle" + ext;
                    SaveGrayStylePicture(bitMapPicture, grayStyleImageFullNameAndPath);

                    Matrix translated = KLTransform(DenseMatrix.OfArray(FromByteMatrixToFloat(Grey)));

                    //creates histogram picture and saves it
                    string histogramFullNameAndPath = Server.MapPath(MyConstants.SELECTED_PICTURE_HISTOGRAM_SAVE_PATH) + selectedFileName + "-3d-histogram" + ext;
                    SaveHistrogram(histogramFullNameAndPath, bitMapPicture.Width, bitMapPicture.Height);

                    string displaySelectedPicturePath  = MyConstants.SELECTED_PICTURE_DISPLAY_PATH + selectedFileName + ext;
                    string displayGrayStylePicturePath = MyConstants.SELECTED_PICTURE_DISPLAY_PATH_GRAYSTYLE + selectedFileName + "-grayStyle" + ext;
                    string displayHistogramPicturePath = MyConstants.SELECTED_PICTURE_HISTOGRAM_DISPLAY_PATH + selectedFileName + "-3d-histogram" + ext;


                    ImageProcessionDataViewModel model = new ImageProcessionDataViewModel()
                    {
                        SelectedPictureName  = displaySelectedPicturePath,
                        GrayStylePictureName = displayGrayStylePicturePath,
                        HistogramName        = displayHistogramPicturePath,
                    };

                    return(View("ProcessImages", model));
                }
                else
                {
                    return(RedirectToAction("ProcessImages"));
                }
            }

            return(RedirectToAction("ProcessImages"));
        }