Ejemplo n.º 1
0
        //////////////////////////////////////////////////////////////////////////////
        //  IPRun() - The thread function IPRun performs the image processing.
        //            It waits for the grabbing thread to indicate a new image in the
        //            image list. After calling the operator FindDataCode2D, the
        //            result values are stored in the ResultContainer instance
        //            resultData, which can be entered only after the previous result
        //            values were displayed (containerIsFree-event).
        //////////////////////////////////////////////////////////////////////////////
        public void IPRun()
        {
            // -------------------  INIT ----------------

            HDataCode2D reader = new HDataCode2D("Data Matrix ECC 200",
                                                 new HTuple(), new HTuple());

            reader.SetDataCode2dParam("default_parameters", "enhanced_recognition");

            // -----------  WAIT FOR EVENTS  ---------------

            while (newImgEvent.WaitOne())
            {
                newImgMutex.WaitOne();             // CriticalSect
                HImage image = (HImage)imgList[0]; // CriticalSect
                imgList.Remove(image);             // CriticalSect
                newImgMutex.ReleaseMutex();        // CriticalSect

                HTuple t1 = HSystem.CountSeconds();

                HTuple decodedDataStrings, resultHandle;

                HXLD symbolXLDs = reader.FindDataCode2d(image, new  HTuple(),
                                                        new HTuple(), out resultHandle, out decodedDataStrings);

                HTuple t2 = HSystem.CountSeconds();

                containerIsFreeEvent.WaitOne();
                resultDataMutex.WaitOne();                    // CriticalSect
                resultData.timeNeeded   = (1000 * (t2 - t1)); // CriticalSect
                resultData.decodedData  = decodedDataStrings; // CriticalSect
                resultData.resultImg    = image;              // CriticalSect
                resultData.resultHandle = resultHandle;       // CriticalSect
                resultData.symbolData   = symbolXLDs;         // CriticalSect
                containerIsFreeEvent.Reset();                 // CriticalSect
                resultDataMutex.ReleaseMutex();               // CriticalSect
                newResultEvent.Set();

                mainForm.Invoke(delegateDisplay);

                if (delegatedStopEvent.WaitOne(0, true))
                {
                    break;
                }
            }
            // --------  RESET/CLOSE ALL HANDLES  ---------

            mainForm.threadAcq.Join();
            mainForm.Invoke(delegateControlReset);

            reader.Dispose();

            newResultEvent.Reset();

            return;
        }
Ejemplo n.º 2
0
        private void OnDeserializedMethod(StreamingContext context)
        {
            _CodeReaderHand = new HDataCode2D("Data Matrix ECC 200", new HTuple(), new HTuple());
            //_CodeReaderHand = new HDataCode2D("QR Code", new HTuple(), new HTuple());

            _CodeReaderHand.SetDataCode2dParam("default_parameters", "standard_recognition");
            _serachRegion   = new HRegion();
            DataCodeString  = string.Empty;
            DataCodeContour = new HXLDCont();
            DisplayControl  = new List <HWindowControl>();
        }
Ejemplo n.º 3
0
        public CodeReader()
        {
            _CodeReaderHand = new HDataCode2D("Data Matrix ECC 200", new HTuple(), new HTuple());
            //_CodeReaderHand = new HDataCode2D("QR Code", new HTuple(), new HTuple());

            _CodeReaderHand.SetDataCode2dParam("default_parameters", "standard_recognition");
            DateCodeZoomImg = 1f;

            DateCodeTimeOut  = true;
            UseBrightenValue = 1.5f;
        }