Пример #1
0
        /// <summary>
        /// 厘定要切割的部分,并重新排列。基类默认方法为直接把所有图片拼接起来。
        /// </summary>
        /// <param name="reset">图片集</param>
        public virtual void CutPicture(ResetPictures reset)
        {
            for (int index_originImage = 0; index_originImage < reset.originImages.Count; index_originImage++)
            {
                (var temp_w, var temp_h) = Identification.GetBytesSize(reset.originImages[index_originImage]);
                reset.ranges.Add((0, index_originImage, temp_w, temp_h, 0, 0));
            }

            reset.ReArray();
        }
Пример #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);
        }