コード例 #1
0
        public Bitmap CreatePrepared()
        {
            if (generated)
            {
                return(result);
            }
            generated = true;

            //BWThreshold, originalForm, smallBWForm, largeForm
            PrepareData();
            List <Vector> impreciseMarkers     = FindMarkersOnSmallForm();
            List <Vector> preciseMarkers       = PrecisifyMarkers(impreciseMarkers);
            List <Vector> identifiedMarkers    = IdentifyMarkers(preciseMarkers);
            List <Vector> fullyRescaledMarkers = identifiedMarkers.Select((a) => a * (originalForm.Width / (double)largeImageWidth)).ToList();

            Bitmap fixedOrientationForm = RotateCrop(fullyRescaledMarkers, originalForm);

            //get rid of lines. The value has been found exprementally
            BitmapUtils.ChangeBrightness(fixedOrientationForm, 1.1);
            //fix under/overexposed images
            BitmapUtils.Autocontrast(fixedOrientationForm);
            Bitmap final = BitmapUtils.MakeGrayscale(fixedOrientationForm);

            result = final;

            return(final);
        }