/// <summary>
        /// Initialize a new SquareDetectionListener.
        /// </summary>
        /// <param name="patternMatchers">The pattern matchers with the marker data.</param>
        /// <param name="cameraParameters">The camera calibration data.</param>
        /// <param name="colorPattern">The used color pattern.</param>
        /// <param name="patternMatchDeviationData">The pattern match deviation data.</param>
        public SquareDetectionListener(List <PatternMatcher> patternMatchers, NyARParam cameraParameters, INyARColorPatt colorPattern, NyARMatchPattDeviationColorData patternMatchDeviationData)
        {
            this.patternMatchers           = patternMatchers;
            this.colorPattern              = colorPattern;
            this.patternMatchDeviationData = patternMatchDeviationData;
            this.coordinationMapper        = new Coord2Linear(cameraParameters.getScreenSize(), cameraParameters.getDistortionFactor());
            this.matrixCalculator          = new NyARTransMat(cameraParameters);
            this.points           = NyARIntPoint2d.createArray(4);
            this.evaluationResult = new NyARMatchPattResult();

            Reset();
        }
        /**
         * コンストラクタから呼び出す関数です。
         * @param i_ref_param
         * @param i_ref_code
         * @param i_marker_width
         * @param i_input_raster_type
         * @param i_profile_id
         * @throws NyARException
         */
        protected void initialize(
            NyARParam i_ref_param,
            NyARCode i_ref_code,
            double i_marker_width,
            int i_input_raster_type,
            int i_profile_id)
        {
            NyARRasterFilter_ARToolkitThreshold th = new NyARRasterFilter_ARToolkitThreshold(100, i_input_raster_type);
            INyARColorPatt            patt_inst;
            NyARSquareContourDetector sqdetect_inst;
            INyARTransMat             transmat_inst;

            switch (i_profile_id)
            {
            case PF_ARTOOLKIT_COMPATIBLE:
                patt_inst     = new NyARColorPatt_O3(i_ref_code.getWidth(), i_ref_code.getHeight());
                sqdetect_inst = new NyARSquareContourDetector_ARToolKit(i_ref_param.getScreenSize());
                transmat_inst = new NyARTransMat_ARToolKit(i_ref_param);
                break;

            case PF_NYARTOOLKIT_ARTOOLKIT_FITTING:
                patt_inst     = new NyARColorPatt_Perspective_O2(i_ref_code.getWidth(), i_ref_code.getHeight(), 4, 25);
                sqdetect_inst = new NyARSquareContourDetector_Rle(i_ref_param.getScreenSize());
                transmat_inst = new NyARTransMat_ARToolKit(i_ref_param);
                break;

            case PF_NYARTOOLKIT:    //default
                patt_inst     = new NyARColorPatt_Perspective_O2(i_ref_code.getWidth(), i_ref_code.getHeight(), 4, 25);
                sqdetect_inst = new NyARSquareContourDetector_Rle(i_ref_param.getScreenSize());
                transmat_inst = new NyARTransMat(i_ref_param);
                break;

            default:
                throw new NyARException();
            }
            base.initInstance(patt_inst, sqdetect_inst, transmat_inst, th, i_ref_param, i_ref_code, i_marker_width);
            return;
        }