예제 #1
0
        public override void CutPicture(ResetPictures reset)
        {
            //var originImages_cf = reset.originImages.Select(n => Identification.BytesColorFilter(n, 70)).ToList();
            var image    = reset.originImages[0];
            var image_cf = Identification.BytesColorFilter(image, 70);

#if DEBUG
            DEBUG_saveImage(image_cf);
#endif
            var cutimages = Identification.BytesCutColumn(image_cf, 7);

#if DEBUG
            DEBUG_save(cutimages);
#endif
            this.cutImageNumber = cutimages.Count;
            cutimages.RemoveAt(6);
            cutimages.RemoveAt(5);
            cutimages.RemoveAt(4);
            cutimages.RemoveAt(3);
            cutimages.RemoveAt(2);
            //var jb = Identification.IdentifyImage(image_cf, ApiVersion.AccurateBasic);
            //base.CutPicture(reset);
            //var xx = 1;
            reset.rearrayImages.Add(Identification.MegerBytesRow(cutimages, 1));

#if DEBUG
            DEBUG_save(reset.rearrayImages);
#endif
        }
예제 #2
0
        public override void CutPicture(ResetPictures reset)
        {
            var image_c  = Identification.MegerBytesRow(reset.originImages);
            var image_cc = Identification.CutBytes(image_c, Identification.GetBytesSize(image_c).width, 500, 0, 0);

            JObject jb_ad;

            try
            {
                jb_ad = Identification.IdentifyImage(image_cc, ApiVersion.General);
            }
            catch (NoApiTimesException e)
            {
                throw e;
            }

            int top    = 0;
            int left   = 0;
            int height = 60;
            int width  = Identification.GetBytesSize(image_c).width;

            foreach (var jd in jb_ad["words_result"])
            {
                string words = jd["words"].ToString();
                if (words.Contains("眼压") || (words.Contains("眼") && words.Contains("mmHg")))
                {
                    top    = Convert.ToInt32(jd["location"]["top"].ToString());
                    left   = Convert.ToInt32(jd["location"]["left"].ToString());
                    height = Convert.ToInt32(jd["location"]["height"].ToString());

                    break;
                }
            }
            var newB = Identification.CutBytes(image_cc, width, height, top, left);
            //var var_firstwidth = 125;

            var cbs = Identification.BytesCutColumn(newB, 7, 0.1);
            var rei = Identification.MegerBytesRow(new List <byte[]> {
                Identification.MegerBytesColumn(new List <byte[]> {
                    cbs[0], cbs[1]
                }), cbs[2], cbs[3]
            });

            reset.rearrayImages.Add(rei);
        }