Exemplo n.º 1
0
        private static void CreateFieldCorrectionWithWinForms()
        {
            //현재 스캐너 보정 파일
            var srcFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "correction", "cor_1to1.ctb");
            //신규로 생성할 스캐너 보정 파일
            var targetFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "correction", $"newfile.ctb");

            // 2차원 스캐너 보정용 IRtcCorrection 객체 생성
            // 3x3 (9개) 위치에 대한 보정 테이블 입력 용
            var correction = new Correction2DRtc(kfactor16bits, 3, 3, 20, 20, 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.002f, 0.001f));
            correction.AddRelative(0, 2, new Vector2(20, 20), new Vector2(-0.0051f, 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.0f, 0.0f));
            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.002f));
            correction.AddRelative(2, 1, new Vector2(0, -20), new Vector2(0.005f, -0.003f));
            correction.AddRelative(2, 2, new Vector2(20, -20), new Vector2(0.002f, -0.008f));
            #endregion

            var form = new Correction2DRtcForm(correction);
            form.ShowDialog();
        }
Exemplo n.º 2
0
        private void btn2DCtb_Click(object sender, EventArgs e)
        {
            //현재 스캐너 보정 파일
            var srcFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "correction", "cor_1to1.ctb");
            //신규로 생성할 스캐너 보정 파일
            var targetFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "correction", $"newfile.ctb");

            // 2차원 스캐너 보정용 IRtcCorrection 객체 생성
            // 3x3 (9개) 위치에 대한 보정 테이블 입력 용
            float fieldSize  = 60;
            float interval   = 20;
            int   rows       = 3;
            int   cols       = 3;
            float kfactor    = (float)Math.Pow(2, 16) / fieldSize;
            var   correction = new Correction2DRtc(kfactor, rows, cols, interval, interval, 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.002f, 0.001f));
            correction.AddRelative(0, 2, new Vector2(20, 20), new Vector2(-0.0051f, 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.0f, 0.0f));
            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.002f));
            correction.AddRelative(2, 1, new Vector2(0, -20), new Vector2(0.005f, -0.003f));
            correction.AddRelative(2, 2, new Vector2(20, -20), new Vector2(0.002f, -0.008f));
            #endregion

            var form = new Correction2DRtcForm(correction);
            form.ShowDialog();
        }
Exemplo n.º 3
0
        /// <summary>
        /// 2D 스캐너 보정 실시 (정사각형 영역)
        /// </summary>
        /// <returns></returns>
        private static string CreateFieldCorrection()
        {
            //현재 스캐너 보정 파일
            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 Correction2DRtc(kfactor20bits, 3, 3, 20, 20, srcFile, targetFile);

            // 좌 상단이 0, 0
            // 0,0  0,1  0,2 ...
            // 1,0  1,1  1,2 ...
            // 2,0  2,1  2,2 ...
            // ...

            #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 Vector2(-20, 20), new Vector2(-20.01f, 20.01f));
            //correction.AddAbsolute(0, 1, new Vector2(0, 20), new Vector2(0.01f, 20.01f));
            //correction.AddAbsolute(0, 2, new Vector2(20, 20), new Vector2(20.01f, 20.01f));
            //correction.AddAbsolute(1, 0, new Vector2(-20, 0), new Vector2(-20.01f, 0.01f));
            //correction.AddAbsolute(1, 1, new Vector2(0, 0), new Vector2(0.01f, 0.01f));
            //correction.AddAbsolute(1, 2, new Vector2(20, 0), new Vector2(20.01f, 0.01f));
            //correction.AddAbsolute(2, 0, new Vector2(-20, -20), new Vector2(-20.01f, -20.01f));
            //correction.AddAbsolute(2, 1, new Vector2(0, -20), new Vector2(0.01f, -20.01f));
            //correction.AddAbsolute(2, 2, new Vector2(20, -20), new Vector2(20.01f, -20.01f));
            #endregion

            //신규 보정 파일 생성 실시
            bool success = correction.Convert();
            //var rtc = ...;
            // 보정 파일을 테이블 1번으로 로딩
            //success &= rtc.CtlLoadCorrectionFile(CorrectionTableIndex.Table1, targetFile);
            // 테이블1 번을 1번 스캐너(Primary Head)에 지정
            //success &= rtc.CtlSelectCorrection(CorrectionTableIndex.Table1);
            return(correction.ResultMessage);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 2D 스캐너 보정 실시 (직사각형 영역)
        /// </summary>
        /// <returns></returns>
        private static string CreateFieldCorrection2()
        {
            //현재 스캐너 보정 파일
            var srcFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "correction", "cor_1to1.ctb");
            //신규로 생성할 스캐너 보정 파일
            var targetFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "correction", $"newfile.ctb");

            // 2차원 스캐너 보정용 IRtcCorrection 객체 생성
            // 3x5 (15개) 위치에 대한 보정 테이블 입력 용 / 간격 10 mm
            var correction = new Correction2DRtc(kfactor16bits, 3, 5, 10, 10, srcFile, targetFile);

            #region inputs relative error deviation : 상대적인 오차위치 값을 넣는 방법 (머신 비전 오차값을 넣는 것과 유사)
            correction.AddRelative(0, 0, new Vector2(-20, 10), new Vector2(0.01f, 0.01f));
            correction.AddRelative(0, 1, new Vector2(-10, 10), new Vector2(0.01f, 0.01f));
            correction.AddRelative(0, 2, new Vector2(0, 10), new Vector2(0.01f, 0.01f));
            correction.AddRelative(0, 3, new Vector2(10, 10), new Vector2(0.01f, 0.01f));
            correction.AddRelative(0, 4, new Vector2(20, 10), 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(-10, 0), new Vector2(0.01f, 0.01f));
            correction.AddRelative(1, 2, new Vector2(0, 0), new Vector2(0.01f, 0.01f));
            correction.AddRelative(1, 3, new Vector2(10, 0), new Vector2(0.01f, 0.01f));
            correction.AddRelative(1, 4, new Vector2(20, 0), new Vector2(0.01f, 0.01f));

            correction.AddRelative(2, 0, new Vector2(-20, -10), new Vector2(0.01f, 0.01f));
            correction.AddRelative(2, 1, new Vector2(-10, -10), new Vector2(0.01f, 0.01f));
            correction.AddRelative(2, 2, new Vector2(0, -10), new Vector2(0.01f, 0.01f));
            correction.AddRelative(2, 3, new Vector2(10, -10), new Vector2(0.01f, 0.01f));
            correction.AddRelative(2, 4, new Vector2(20, -10), new Vector2(0.01f, 0.01f));
            #endregion

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