Exemple #1
0
        static void test_CS_CPP_Graber_thread_process_img(bool isPrint, CSImgT imgT)
        {
            for (DataNames i = 0; i < DataNames.SCA2_CAL; ++i)
            {
                unit_test_print(isPrint, imgT.DN2Str(i));
            }
            // --- test CSR3 ImgT data array
            byte[] senData = imgT.getDataByte(DataNames.SEN);

            // --- test CSImgT data info getting
            int cols = imgT.get_cols(DataNames.SEN);
            int rows = imgT.get_rows(DataNames.SEN);

            int    S_cols          = imgT.getS_cols();
            int    S_rows          = imgT.getS_rows();
            int    S_OffsetX       = imgT.getS_OffsetX();
            int    S_OffsetY       = imgT.getS_OffsetY();
            int    R_cols          = imgT.getR_cols();
            int    R_rows          = imgT.getR_rows();
            int    R_AoiOffsetX    = imgT.getR_AoiOffsetX();
            int    R_AoiOffsetY    = imgT.getR_AoiOffsetY();
            int    R_AoiHeight     = imgT.getR_AoiHeight();
            int    R_AoiWidth      = imgT.getR_AoiWidth();
            bool   R_RangeAxis     = imgT.getR_RangeAxis();
            int    C_cols          = imgT.getC_cols();
            int    C_rows          = imgT.getC_rows();
            double C_offsetX       = imgT.getC_offsetX();
            double C_offsetY       = imgT.getC_offsetY();
            double C_scaleX        = imgT.getC_scaleX();
            double C_scaleY        = imgT.getC_scaleY();
            double C_lower_bound_x = imgT.getC_lower_bound_x();
            double C_upper_bound_x = imgT.getC_upper_bound_x();
            double C_lower_bound_r = imgT.getC_lower_bound_r();
            double C_upper_bound_r = imgT.getC_upper_bound_r();

            /// test CS ImgT data info getting
            int  id    = imgT.get_ID();
            bool isE   = imgT.isEmpty();
            bool hasS  = imgT.has(DataNames.SEN);
            bool hasR  = imgT.has(DataNames.RAN);
            bool hasCI = imgT.has_ChunkInfo();

            bool saveSenOk = imgT.SaveToIconFile("D:\\sen", DataNames.SEN);
            bool saveRanOk = imgT.SaveToIconFile("D:\\ran", DataNames.RAN);
            bool saveRacOk = imgT.SaveToIconFile("D:\\rac", DataNames.RAN_CAL);

            unit_test_print(true, "Get Image, id = {0}", id);
        }
Exemple #2
0
        private void toolStripComboBoxMode_Click(object sender, EventArgs e)
        {
            var status = R3(m_ip).getStatus();

            if (status == CAM_STATUS.CAM_IS_STARTED)
            {
                Stop();
            }
            if (status == CAM_STATUS.CAM_IS_DISCONNECTED)
            {
                toolStripComboBoxMode.SelectedIndex = (int)m_GrabMode; // revert to last avalible value
            }


            // check if Grab Mode match parameter setting.
            // Grab Mode is under control by parameter setting.
            var lstGrabMode = m_GrabMode;

            m_GrabMode = (DataNames)toolStripComboBoxMode.SelectedIndex;
            if (checkGrabMode())
            {
                //var selectedId = toolStripComboBoxMode.SelectedIndex;
                //m_GrabMode = (DataNames)selectedId;
                m_GrabMode = (DataNames)toolStripComboBoxMode.SelectedIndex;


                if (R3(m_ip).getStatus() == CAM_STATUS.CAM_IS_STOPPED) // does not support connected on purpose!
                {
                    Start();
                }
            }
            else
            {
                toolStripComboBoxMode.SelectedIndex = (int)lstGrabMode; // revert to last avalible value
            }
        }
Exemple #3
0
 public ChartField(string name, string fieldName)
 {
     Name  = name;
     Names = new DataNames(fieldName);
 }
Exemple #4
0
        /////////////////////////////////////////////////////////////////////////////////////


        static bool test_CS_basic_functions(bool isPrintToScream = true)
        {
            bool enable_CPP_Grab_thread = false;

            // --- test CSR3S. (Please note: "CS" = C_Sharp, "R3S" = Ranger3_Shared_runtime_environment, So "CSR3S" = class of C_Sharp_Ranger3_Shared_runtime_environment.)
            String    logPath    = "D:\\log.txt";
            String    ctiPath    = "";
            bool      isPrintLog = isPrintToScream;
            bool      isWriteLog = true;
            GenICam3D r3s        = new GenICam3D(logPath, ctiPath, isPrintLog, isWriteLog);

            String[] IPs     = r3s.getConDevListIP();
            String[] Nas     = r3s.getConDevList();
            var      scanRes = r3s.scanDevice();

            // --- test CSR3. (Please note: "CS" = C_Sharp, "R3" = Ranger3, So "CSR3" = class of C_Sharp_Ranger3.)
            String  mac = "0006770c69e1";
            Ranger3 r3  = new Ranger3(mac, false);

            /// CSR3 r3 = new CSR3(IPs[0], true);

            if (r3.isReady() != CAM_STATUS.All_OK)
            {
                if (isPrintToScream)
                {
                    unit_test_print(isPrintToScream, "Camera is not ready!");
                }
                return(false);
            }

            var camStatus = r3.connectCamera(enable_CPP_Grab_thread);

            if (camStatus != CAM_STATUS.All_OK)
            {
                if (isPrintToScream)
                {
                    unit_test_print(isPrintToScream, "Camera connecting failed!");
                }
                return(false);
            }

            /// test CS getting paramters info
            if (r3.updateParamtersInfo() == false)
            {
                return(false);
            }

            String[] CategoryList = r3.paramCategoryList();
            String[] FullNameList = r3.paramFullNameList();
            int      fnId         = 0;

            unit_test_print(isPrintToScream, "");
            unit_test_print(isPrintToScream, "--------------");
            foreach (String cate in CategoryList)
            {
                unit_test_print(isPrintToScream, "|");
                unit_test_print(isPrintToScream, "----  Cate: {0}", cate);
                String[] categries = r3.paramFullNameOfCategory(cate);
                foreach (String fn in categries)
                {
                    unit_test_print(isPrintToScream, "    |");  unit_test_print(isPrintToScream, "    --- FullName: {0}", fn);
                    unit_test_print(isPrintToScream, "        |");  unit_test_print(isPrintToScream, "        --- CurrentValue: {0}", r3.paramCurrentValue(fn));
                    unit_test_print(isPrintToScream, "        |");  unit_test_print(isPrintToScream, "        --- Optional values:");
                    String[] opt = r3.paramOptionalValues(fn, ref fnId);
                    foreach (String sub in opt)
                    {
                        unit_test_print(isPrintToScream, "               |");
                        unit_test_print(isPrintToScream, "               ---- {0}", sub);
                    }
                }
            }


            // --- test CSR3 setting paramters info
            ///r3.setParameterValue("DeviceScanType", "Linescan3D");    /// 3D Range image
            r3.setParameterValue("DeviceScanType", "Areascan");         /// 2D Sensor image



            camStatus = r3.startCamera();
            if (camStatus != CAM_STATUS.All_OK)
            {
                unit_test_print(isPrintToScream, "Camera starting failed!");
                return(false);
            }

            // --- test CSR3 acquisition
            Thread.Sleep(1000);

            // --- test CS ImgT
            CSImgT imgT = new CSImgT();

            camStatus = r3.getImageData(imgT);

            for (DataNames i = 0; i < DataNames.SCA2_CAL; ++i)
            {
                unit_test_print(isPrintToScream, imgT.DN2Str(i));
            }
            // --- test CSR3 ImgT data array
            byte[] senData = imgT.getDataByte(DataNames.SEN);

            // --- test CSImgT data info getting
            int    S_cols          = imgT.getS_cols();
            int    S_rows          = imgT.getS_rows();
            int    S_OffsetX       = imgT.getS_OffsetX();
            int    S_OffsetY       = imgT.getS_OffsetY();
            int    R_cols          = imgT.getR_cols();
            int    R_rows          = imgT.getR_rows();
            int    R_AoiOffsetX    = imgT.getR_AoiOffsetX();
            int    R_AoiOffsetY    = imgT.getR_AoiOffsetY();
            int    R_AoiHeight     = imgT.getR_AoiHeight();
            int    R_AoiWidth      = imgT.getR_AoiWidth();
            bool   R_RangeAxis     = imgT.getR_RangeAxis();
            int    C_cols          = imgT.getC_cols();
            int    C_rows          = imgT.getC_rows();
            double C_offsetX       = imgT.getC_offsetX();
            double C_offsetY       = imgT.getC_offsetY();
            double C_scaleX        = imgT.getC_scaleX();
            double C_scaleY        = imgT.getC_scaleY();
            double C_lower_bound_x = imgT.getC_lower_bound_x();
            double C_upper_bound_x = imgT.getC_upper_bound_x();
            double C_lower_bound_r = imgT.getC_lower_bound_r();
            double C_upper_bound_r = imgT.getC_upper_bound_r();

            /// test CS ImgT data info getting
            int  id    = imgT.get_ID();
            bool isE   = imgT.isEmpty();
            bool hasS  = imgT.has(DataNames.SEN);
            bool hasR  = imgT.has(DataNames.RAN);
            bool hasCI = imgT.has_ChunkInfo();

            bool saveSenOk = imgT.SaveToIconFile("D:\\sen", DataNames.SEN);
            bool saveRanOk = imgT.SaveToIconFile("D:\\ran", DataNames.RAN);
            bool saveRacOk = imgT.SaveToIconFile("D:\\rac", DataNames.RAN_CAL);

            camStatus = r3.stopCamera();
            if (camStatus != CAM_STATUS.All_OK)
            {
                unit_test_print(isPrintToScream, "Camera stopping failed!");
                return(false);
            }

            camStatus = r3.disconnectCamera();
            if (camStatus != CAM_STATUS.All_OK)
            {
                unit_test_print(isPrintToScream, "Camera disconnecting failed!");
                return(false);
            }
            return(true);
        }
Exemple #5
0
 public void WashNode()
 {
     this.name = DataNames.Uninitialized;
     this.x    = 0;
 }
Exemple #6
0
 public void Set(DataNames name, int num)
 {
     this.name = name;
     this.x    = num;
 }
Exemple #7
0
 //constructors
 public Node(DataNames name, int val) : base()
 {
     this.Set(name, val);
 }
 public bool NameMatches(string lookingFor)
 {
     return(DataNames.Contains(lookingFor));
 }