示例#1
0
        /// <summary>
        /// 나선 객체의 위치를 측정하여 해당 오류값을 넣기
        /// </summary>
        /// <returns></returns>
        private static string CreateFieldCorrection()
        {
            #region 상대적인 오차값을 넣는 방법
            IRtcCorrection correction = new RtcCorrection2D(0, 3, 3, "cor_1to1.ct5", "newfile.ct5");
            correction.AddRelative(0, 0, new Vector3(-20, 20, 0), new Vector3(0.01f, 0.01f, 0));
            correction.AddRelative(0, 1, new Vector3(0, 20, 0), new Vector3(0.01f, 0.01f, 0));
            correction.AddRelative(0, 2, new Vector3(20, 20, 0), new Vector3(0.01f, 0.01f, 0));
            correction.AddRelative(1, 0, new Vector3(-20, 0, 0), new Vector3(0.01f, 0.01f, 0));
            correction.AddRelative(1, 1, new Vector3(0, 0, 0), new Vector3(0.01f, 0.01f, 0));
            correction.AddRelative(1, 2, new Vector3(20, 0, 0), new Vector3(0.01f, 0.01f, 0));
            correction.AddRelative(2, 0, new Vector3(-20, -20, 0), new Vector3(0.01f, 0.01f, 0));
            correction.AddRelative(2, 1, new Vector3(0, -20, 0), new Vector3(0.01f, 0.01f, 0));
            correction.AddRelative(2, 2, new Vector3(20, -20, 0), new Vector3(0.01f, 0.01f, 0));
            #endregion

            #region 절대적인 오차값을 넣는 방법
            //IRtcCorrection correction = new RtcCorrection2D(0, 3, 3, "cor_1to1.ct5", "newfile.ct5");
            //correction.AddAbsolute(0, 0, new Vector3(-20, 20, 0), new Vector3(-20.01f, 20.01f, 0));
            //correction.AddAbsolute(0, 1, new Vector3(0, 20, 0), new Vector3(0.01f, 20.01f, 0));
            //correction.AddAbsolute(0, 2, new Vector3(20, 20, 0), new Vector3(20.01f, 20.01f, 0));
            //correction.AddAbsolute(1, 0, new Vector3(-20, 0, 0), new Vector3(-20.01f, 0.01f, 0));
            //correction.AddAbsolute(1, 1, new Vector3(0, 0, 0), new Vector3(0.01f, 0.01f, 0));
            //correction.AddAbsolute(1, 2, new Vector3(20, 0, 0), new Vector3(20.01f, 0.01f, 0));
            //correction.AddAbsolute(2, 0, new Vector3(-20, -20, 0), new Vector3(-20.01f, -20.01f, 0));
            //correction.AddAbsolute(2, 1, new Vector3(0, -20, 0), new Vector3(0.01f, -20.01f, 0));
            //correction.AddAbsolute(2, 2, new Vector3(20, -20, 0), new Vector3(20.01f, -20.01f, 0));
            #endregion

            if (correction.Convert())
            {
                return(correction.ResultMessage);
            }
            return("fail to convert new correction file !");
        }
示例#2
0
        /// <summary>
        /// 나선 객체의 위치를 측정하여 해당 오류값을 넣기
        /// </summary>
        /// <returns></returns>
        private static string CreateFieldCorrection(IRtc rtc)
        {
            ///현재 스캐너 보정 파일
            var srcFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "correction", "cor_1to1.ct5");
            ///신규로 생성할 스캐너 보정 파일
            var targetFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "correction", $"newfile.ct5");
            /// 2차원 스캐너 보정용 IRtcCorrection 객체 생성
            /// 3x3 (9개) 위치에 대한 보정 테이블 입력 용
            var correction = new RtcCorrection2D(0, kfactor, 3, 3, srcFile, targetFile);

            #region inputs relative error deviation : 상대적인 오차위치 값을 넣는 방법
            correction.AddRelative(0, 0, new Vector2(-20, 20), new Vector2(0.01f, 0.01f));
            correction.AddRelative(0, 1, new Vector2(0, 20), new Vector2(0.01f, 0.01f));
            correction.AddRelative(0, 2, new Vector2(20, 20), new Vector2(0.01f, 0.01f));
            correction.AddRelative(1, 0, new Vector2(-20, 0), new Vector2(0.01f, 0.01f));
            correction.AddRelative(1, 1, new Vector2(0, 0), new Vector2(0.01f, 0.01f));
            correction.AddRelative(1, 2, new Vector2(20, 0), new Vector2(0.01f, 0.01f));
            correction.AddRelative(2, 0, new Vector2(-20, -20), new Vector2(0.01f, 0.01f));
            correction.AddRelative(2, 1, new Vector2(0, -20), new Vector2(0.01f, 0.01f));
            correction.AddRelative(2, 2, new Vector2(20, -20), new Vector2(0.01f, 0.01f));
            #endregion

            #region inputs absolute position values : 오차값의 절대적인 위치 정보를 넣는 방법
            //correction.AddAbsolute(0, 0, new Vector3(-20, 20, 0), new Vector3(-20.01f, 20.01f, 0));
            //correction.AddAbsolute(0, 1, new Vector3(0, 20, 0), new Vector3(0.01f, 20.01f, 0));
            //correction.AddAbsolute(0, 2, new Vector3(20, 20, 0), new Vector3(20.01f, 20.01f, 0));
            //correction.AddAbsolute(1, 0, new Vector3(-20, 0, 0), new Vector3(-20.01f, 0.01f, 0));
            //correction.AddAbsolute(1, 1, new Vector3(0, 0, 0), new Vector3(0.01f, 0.01f, 0));
            //correction.AddAbsolute(1, 2, new Vector3(20, 0, 0), new Vector3(20.01f, 0.01f, 0));
            //correction.AddAbsolute(2, 0, new Vector3(-20, -20, 0), new Vector3(-20.01f, -20.01f, 0));
            //correction.AddAbsolute(2, 1, new Vector3(0, -20, 0), new Vector3(0.01f, -20.01f, 0));
            //correction.AddAbsolute(2, 2, new Vector3(20, -20, 0), new Vector3(20.01f, -20.01f, 0));
            #endregion

            ///신규 보정 파일 생성 실시
            bool success = correction.Convert();
            /// 보정 파일을 테이블 1번으로 로딩
            success &= rtc.CtlLoadCorrectionFile(CorrectionTableIndex.Table1, targetFile);
            /// 테이블1 번을 1번 스캐너(Primary Head)에 지정
            success &= rtc.CtlSelectCorrection(CorrectionTableIndex.Table1);
            if (success)
            {
                return(correction.ResultMessage);
            }
            else
            {
                return("fail to convert new correction file !");
            }
        }