예제 #1
0
        public sdkFrameRecgV3Man(GNPXApp000 pGNP00, string fName, int MLtype = 6, int MidLSize = 64, double gammaC = 0.7)
        {
            pGNP00win         = pGNP00.pGNP00win;
            this.fName        = fName;
            Send_DigitsRecog += new SDKEventHandler(pGNP00win.DigitsRecogReport);

            if (sdkFRec == null)
            {
                sdkFRec = new sdkFrameRecgV3(fName: fName);
            }
            SDK64 = Enumerable.Repeat(0xFFFFFFFF, 81).ToArray();
        }
예제 #2
0
        private bool DigitRecog(out int[] SDK8, bool dispB = false)
        {
            Mat _frame = NuPz_Win.frame00.CvtColor(ColorConversionCodes.BGR2GRAY);

            Cv2.AdaptiveThreshold(_frame, frameWB, 255, AdaptiveThresholdTypes.GaussianC, ThresholdTypes.Binary, 51, 5);  //c=10

            if (sdkFRec == null)
            {
                sdkFRec = new sdkFrameRecgV3(fName: fName);
            }
            SDK8 = sdkFRec.sdkFrameRecg_SolverV3(imgWhiteB: frameWB, thrVal: 128, DispB: false);
            if (SDK8 == null)
            {
                return(false);
            }
            for (int k = 0; k < 81; k++)
            {
                SDK64[k] = SDK64[k] << 4 | (uint)(SDK8[k] & 0xF);
            }

            bool succB = false;

            SDK8 = DigitRecog_MajorityVote(ref succB);

            if (dispB)
            {
                string st  = "";
                int    eCC = 0;
                foreach (var p in SDK8)
                {
                    if (p == 0 || p > 10)
                    {
                        st += "#"; eCC++;
                    }
                    else
                    {
                        st += (p <= 9)? p.ToString(): ".";
                    }
                }
                WriteLine("DigitRecog:" + st);
            }
            return(succB);
        }