Exemple #1
0
        private void Act_Source(HImage image, HTuple angle, int i)
        {
            HObject temp = new HObject();

            temp.GenEmptyObj();
            HTuple dist_PZT_temp, pZTOkNg_temp;
            HTuple hv_Rows1, hv_Cols1, hv_Rows2, hv_Cols2;

            PZT_Detection_ext(Pzt_Region_Affine, image, out temp,
                              new HTuple(mesureNumber), angle[i], new HTuple(mes_width),
                              new HTuple(sigma), new HTuple(threshold), new HTuple(dist_STD),
                              out dist_PZT_temp, out pZTOkNg_temp, out hv_Rows1,
                              out hv_Cols1, out hv_Rows2, out hv_Cols2);

            if (pZTOkNg.Length == 0)
            {
                dist_PZT = dist_PZT_temp;
                pZTOkNg  = pZTOkNg_temp;
            }
            else
            {
                dist_PZT = dist_PZT.TupleConcat(dist_PZT_temp);
                pZTOkNg  = pZTOkNg.TupleConcat(pZTOkNg_temp);
            }
            if (temp != null && temp.IsInitialized())
            {
                HXLD temp2 = new HXLD(temp);
                Arrow = Arrow.ConcatObj(temp2);
                temp.Dispose();
                temp2.Dispose();
            }
        }
Exemple #2
0
        private void Act_Engine(HImage image, HTuple Angle, int i)
        {
            PTZ_Detection_ProcedureCall.SetInputIconicParamObject("R", image);
            PTZ_Detection_ProcedureCall.SetInputIconicParamObject("RegionPZT_T", Pzt_Region_Affine);
            PTZ_Detection_ProcedureCall.SetInputCtrlParamTuple("mesureNumber", new HTuple(mesureNumber));
            PTZ_Detection_ProcedureCall.SetInputCtrlParamTuple("mes_width", new HTuple(mes_width));
            PTZ_Detection_ProcedureCall.SetInputCtrlParamTuple("threshold", new HTuple(threshold));
            PTZ_Detection_ProcedureCall.SetInputCtrlParamTuple("dist_STD", new HTuple(dist_STD));
            PTZ_Detection_ProcedureCall.SetInputCtrlParamTuple("dist_max", new HTuple(dist_max));
            PTZ_Detection_ProcedureCall.SetInputCtrlParamTuple("angle", Angle[i]);
            PTZ_Detection_ProcedureCall.SetInputCtrlParamTuple("sigma", new HTuple(sigma));
            PTZ_Detection_ProcedureCall.Execute();
            if (pZTOkNg.Length == 0)
            {
                dist_PZT = (PTZ_Detection_ProcedureCall.GetOutputCtrlParamTuple("dist_PZT"));
                pZTOkNg  = (PTZ_Detection_ProcedureCall.GetOutputCtrlParamTuple("pZTOkNg"));
            }
            else
            {
                dist_PZT = dist_PZT.TupleConcat(PTZ_Detection_ProcedureCall.GetOutputCtrlParamTuple("dist_PZT"));
                pZTOkNg  = pZTOkNg.TupleConcat(PTZ_Detection_ProcedureCall.GetOutputCtrlParamTuple("pZTOkNg"));
            }
            HXLD temp = new HXLD();

            temp = PTZ_Detection_ProcedureCall.GetOutputIconicParamXld("Arrow");
            if (temp != null && temp.IsInitialized())
            {
                Arrow = Arrow.ConcatObj(temp);
                temp.Dispose();
            }
        }
        //////////////////////////////////////////////////////////////////////////////
        // DisplayResults() - This method is used in/as a delegate. It is invoked
        //                    from the main GUI thread
        //////////////////////////////////////////////////////////////////////////////
        public void DisplayResults()
        {
            int i;

            resultDataMutex.WaitOne();                          // CriticalSect
            HTuple time = resultData.timeNeeded;                // CriticalSect
            HTuple decodedDataStrings = resultData.decodedData; // CriticalSect
            HImage image        = resultData.resultImg;         // CriticalSect
            HTuple resultHandle = resultData.resultHandle;      // CriticalSect
            HXLD   symbolXLDs   = resultData.symbolData;        // CriticalSect

            containerIsFreeEvent.Set();                         // CriticalSect
            resultDataMutex.ReleaseMutex();                     // CriticalSect

            window.DispObj(image);
            window.DispObj(symbolXLDs);

            mainForm.procTimeLabel.Text = time.TupleString(".1f") + "  ms";
            mainForm.procTimeLabel.Refresh();

            for (i = 0; i < resultHandle.Length; i++)
            {
                mainForm.imageDataLabel.Text = decodedDataStrings[i].S;
                mainForm.imageDataLabel.Refresh();
            }

            image.Dispose();
            symbolXLDs.Dispose();
        }
Exemple #4
0
        public bool PZT_Detection_Act(HImage image, List <HHomMat2D> Mat2Ds, HTuple Angle)
        {
            try
            {
                if (!bIsInitial)
                {
                    Initial_PZT_Detection();
                }
                if (Pzt_Region == null || !Pzt_Region.IsInitialized())
                {
                    return(false);
                }
                if (Mat2Ds == null || Mat2Ds.Count() < 1)
                {
                    return(false);
                }
                if (Arrow == null)
                {
                    Arrow = new HXLD();
                }
                if (Arrow != null && Arrow.IsInitialized())
                {
                    Arrow.Dispose();
                }
                Arrow.GenEmptyObj();
                dist_PZT = new HTuple();

                pZTOkNg = new HTuple();

                for (int i = 0; i < Mat2Ds.Count(); i++)
                {
                    if (Pzt_Region_Affine != null && Pzt_Region_Affine.IsInitialized())
                    {
                        Pzt_Region_Affine.Dispose();
                    }
                    Pzt_Region_Affine = Mat2Ds[i].AffineTransRegion(Pzt_Region, "nearest_neighbor");
                    Act_Engine(image, Angle, i);
                    //Act_Source(image, Angle, i);
                }
            }
            catch
            {
                return(false);
            }
            return(true);
        }