Ejemplo n.º 1
0
        /**
         * i_imageから、idマーカを読みだします。
         * o_dataにはマーカデータ、o_paramにはまーかのパラメータを返却します。
         * @param image
         * @param i_square
         * @param o_data
         * @param o_param
         * @return
         * @throws NyARException
         */
        public bool pickFromRaster(INyARRgbRaster image, NyARIntPoint2d[] i_vertex, NyIdMarkerPattern o_data, NyIdMarkerParam o_param)
        {
            //遠近法のパラメータを計算
            if (!this._perspective_reader.setSourceSquare(i_vertex))
            {
                return(false);
            }
            ;

            INyARRgbPixelReader reader      = image.getRgbPixelReader();
            NyARIntSize         raster_size = image.getSize();


            PerspectivePixelReader.TThreshold th = this.__pickFromRaster_th;
            MarkerPattEncoder encoder            = this.__pickFromRaster_encoder;

            //マーカパラメータを取得
            this._perspective_reader.detectThresholdValue(reader, raster_size, th);

            if (!this._perspective_reader.readDataBits(reader, raster_size, th, encoder))
            {
                return(false);
            }
            int d = encoder.encode(o_data);

            if (d < 0)
            {
                return(false);
            }
            o_param.direction = d;
            o_param.threshold = th.th;

            return(true);
        }
Ejemplo n.º 2
0
        /**
         * i_imageから、idマーカを読みだします。
         * o_dataにはマーカデータ、o_paramにはマーカのパラメータを返却します。
         * @param image
         * @param i_vertex
         * @param o_data
         * @param o_param
         * @return
         * @
         */
        private bool _pickFromRaster(INyARGsPixelDriver i_pix_drv, NyIdMarkerPattern o_data, NyIdMarkerParam o_param)
        {
            PerspectivePixelReader.TThreshold th = this.__pickFromRaster_th;
            MarkerPattEncoder encoder            = this.__pickFromRaster_encoder;

            //マーカパラメータを取得
            this._perspective_reader.detectThresholdValue(i_pix_drv, th);

            if (!this._perspective_reader.readDataBits(i_pix_drv, i_pix_drv.getSize(), th, encoder))
            {
                return(false);
            }
            int d = encoder.encode(o_data);

            if (d < 0)
            {
                return(false);
            }
            o_param.direction = d;
            o_param.threshold = th.th;

            return(true);
        }