Esempio n. 1
0
        /*********************************************************/
        public void UpdateDocFromText()
        {
            doc = new HtmlDocument();
            doc.LoadHtml(htmlText);

            Sectionizer sz = new Sectionizer();

            Sections = sz.ProcessHtml(ref doc);
        }
        public static ScanAndGrade  findBubbles(Bitmap input, ExamSpecifics APBiologyExam)
        {
            Bitmap stretched = new Bitmap(input, (int)(input.Width), (int)(input.Height));

            Image <Gray, Byte> grayImage = new Image <Bgr, byte>(stretched).Convert <Gray, Byte>();

            CvInvoke.Threshold(grayImage, grayImage, 120, 1000, Emgu.CV.CvEnum.ThresholdType.BinaryInv);

            Gray cannyThreshold = new Gray(1);

            Gray circleAccumulatorThreshold = new Gray(30);

            CircleF[] circles = grayImage.HoughCircles(
                cannyThreshold,
                circleAccumulatorThreshold,
                1,    //Resolution of the accumulator used to detect centers of the circles
                1,    //min distance
                15,   //min radius
                60    //max radius
                )[0]; //Get the circles from the first channel

            Graphics f = Graphics.FromImage(input);


            Graphics g = Graphics.FromImage(stretched);



            List <Point> circleCenter = new List <Point>();

            double avRadius = 0;


            foreach (CircleF c1 in circles)
            {
                avRadius = avRadius + c1.Radius;
                circleCenter.Add(new Point((int)c1.Center.X, (int)c1.Center.Y));
            }
            avRadius = avRadius / circles.Count();

            input.Save("presorted.png");
            Sectionizer testSections = new Sectionizer(circleCenter, avRadius);


            ScanAndGrade scantron = new ScanAndGrade(stretched, testSections, APBiologyExam, avRadius);

            Debug.WriteLine("AP Biology Exam Score: " + scantron.FinalUnweightedScore);


            return(scantron);
        }
Esempio n. 3
0
        /*********************************************************/
        public void ProcessDocument()
        {
            doc = new HtmlDocument();
            doc.LoadHtml(htmlText);

            StampAuthorAndTime();

            ParagraphRuleTag prt = new ParagraphRuleTag();

            if (proband != null)
            {
                prt.proband = proband;
            }
            prt.ProcessHtml(ref doc);

            if (UseDocArgs)
            {
                DocumentArgs da = new DocumentArgs();
                da.relativeID = relativeID;
                if (proband != null)
                {
                    da.proband = proband;
                }
                da.ProcessHtml(ref doc);
            }

            //start the tag replacement
            ImageTag it = new ImageTag();

            it.DocumentHtmlPath = htmlPath;
            it.ProcessHtml(ref doc);

            SqlExecTag exec = new SqlExecTag();

            exec.ProcessHtml(ref doc);

            MakeTableTag mt = new MakeTableTag();

            mt.ProcessHtml(ref doc);

            MakeListTag ml = new MakeListTag();

            ml.ProcessHtml(ref doc);

            MakeResponseTableTag mrt = new MakeResponseTableTag();

            mrt.ProcessHtml(ref doc);

            PedigreeTag pt = new PedigreeTag();

            if (proband != null)
            {
                pt.proband = proband;
            }
            pt.ProcessHtml(ref doc);

            RiskChartTag rct = new RiskChartTag();

            if (proband != null)
            {
                rct.proband = proband;
            }
            rct.ProcessHtml(ref doc);

            AreaProvidersTag apt = new AreaProvidersTag();

            if (proband != null)
            {
                apt.proband = proband;
            }
            apt.ProcessHtml(ref doc);

            Sectionizer sz = new Sectionizer();

            Sections = sz.ProcessHtml(ref doc);


            TableColumnTag tc = new TableColumnTag();

            if (proband != null)
            {
                tc.proband = proband;
            }
            tc.ProcessHtml(ref doc);

            InsertTemplateTag itt = new InsertTemplateTag();

            itt.UseDocArgs = UseDocArgs;
            if (proband != null)
            {
                itt.proband = proband;
            }
            itt.ProcessHtml(ref doc);

            htmlText = ProcessFormatingTags(doc.DocumentNode.OuterHtml);
        }