public void ProcessImage(IVideoCapture captureDevice, byte[] imagePtr)
        {
            if (captureDevice.Format != ImageFormat.B8G8R8A8_32)
                throw new MarkerException("Only ImageFormat.B8G8R8A8_32 format is acceptable for NyARToolkitTracker");

            // initialize the detector right before the image processing
            if (!started)
            {
                multiDetector = new MarkerDetector(param, codes.ToArray(), pattSizes.ToArray(),
                    codes.Count, raster.getBufferType());
                multiDetector.setContinueMode(continuousMode);
                started = true;
            }

            raster.SetBuffer(imagePtr);

            UpdateMarkerTransforms();
        }
        /// <summary>
        /// Associates a marker with an identifier so that the identifier can be used to find this
        /// marker after processing the image. 
        /// </summary>
        /// <param name="markerConfigs">A set of parameters that identifies a maker. (e.g., for
        /// ARTag, this parameter would be the marker array name or marker ID)</param>
        /// <returns>An identifier for this marker object</returns>
        public Object AssociateMarker(params Object[] markerConfigs)
        {
            // make sure we are initialized
            if (!initialized)
                throw new MarkerException("ARToolkitTracker is not initialized. Call InitTracker(...)");

            if (!(markerConfigs.Length == 2 || markerConfigs.Length == 5))
                throw new MarkerException(GetAssocMarkerUsage());

            MarkerInfo markerInfo = new MarkerInfo();

            if (markerConfigs.Length == 2)
            {
                string arrayName = "";
                ComputationMethod method = ComputationMethod.Average;

                try
                {
                    arrayName = (String)markerConfigs[0];
                    method = (ComputationMethod)markerConfigs[1];
                }
                catch (Exception)
                {
                    throw new MarkerException(GetAssocMarkerUsage());
                }

                ParseArray(arrayName, ref markerInfo);

                markerInfo.Method = method;
            }
            else
            {
                int pattWidth = 0, pattHeight = 0;
                float pattSize = 0, conf = 0;
                String pattName = "";

                try
                {
                    pattName = (String)markerConfigs[0];
                    pattWidth = (int)markerConfigs[1];
                    pattHeight = (int)markerConfigs[2];
                    pattSize = (float)markerConfigs[3];
                    conf = (float)markerConfigs[4];
                }
                catch (Exception)
                {
                    throw new MarkerException(GetAssocMarkerUsage());
                }

                NyARCode code = new NyARCode(pattWidth, pattHeight);
                code.loadARPatt(new System.IO.StreamReader(TitleContainer.OpenStream(pattName)));
                codes.Add(code);
                pattSizes.Add(pattSize);

                PatternInfo info = new PatternInfo();
                info.ConfidenceThreshold = conf;

                int id = codes.Count - 1;
                markerInfo.PatternInfos.Add(id, info);
                markerInfo.RelativeTransforms.Add(id, Matrix.Identity);
                markerInfo.Method = ComputationMethod.Average;

                markerInfoMap.Add(id, markerInfo);
            }

            markerInfoList.Add(markerInfo);

            // reinitialize the multi marker detector if the programmer adds new marker node
            // after the initialization phase
            if (started)
            {
                multiDetector = new MarkerDetector(param, codes.ToArray(), pattSizes.ToArray(),
                    codes.Count, raster.getBufferType());
                multiDetector.setContinueMode(continuousMode);
            }

            return markerInfo;
        }