private void OnUpdatedSetting()
 {
     calibrator.SizeX     = setting.sizeX;
     calibrator.SizeY     = setting.sizeY;
     calibrator.boardType = setting.boardType;
     calibrator.Clear();
     calibrator.Setup();
     drawCornerObject.SetActive(setting.drawCorners);
 }
    IEnumerator CalibrateRoutine()
    {
        if (!Directory.Exists(directory))
        {
            yield break;
        }
        ;

        var files = Directory.GetFiles(directory);

        files = files.Where(e => targetExtensions.Contains(Path.GetExtension(e).ToLower())).ToArray();
        if (files.Length < 1)
        {
            yield break;
        }
        ;

        calibrator.Setup();
        for (var i = 0; i < files.Length; i++)
        {
            using (Mat gray = Imgcodecs.imread(files[i], Imgcodecs.IMREAD_GRAYSCALE))
            {
                if (i == 0)
                {
                    Init(gray);
                }
                calibrator.Calibrate(gray);
                if (draw)
                {
                    Imgproc.cvtColor(gray, rgbMat, Imgproc.COLOR_GRAY2RGB);
                    calibrator.Draw(gray, rgbMat);
                    Utils.matToTexture2D(rgbMat, texture);
                    renderer.material.mainTexture = texture;
                }

                print("progress : " + (i + 1) + " / " + files.Length);
                yield return(new WaitForSeconds(interval));
            }
        }
        if (autoSave)
        {
            calibrator.Save(IOHandler.IntoStreamingAssets(fileName));
        }

        calibrator.Clear();

        print("Complete Calibration");
        yield break;
    }