/// <summary>
        /// Creates a new coordinate mapper for the specified pipeline.
        /// </summary>
        /// <param name="pipeline">The specified pipeline.</param>
        /// <param name="colorWidth">The desired color frame width.</param>
        /// <param name="colorHeight">The desired color frame height.</param>
        /// <param name="depthWidth">The desired depth frame width.</param>
        /// <param name="depthHeight">The desired depth frame height.</param>
        /// <returns>The color/depth coordinate mapper of the current pipline, if all of the supported streams were found. Null otherwise.</returns>
        public static CoordinateMapper Create(PipelineProfile pipeline, int colorWidth, int colorHeight, int depthWidth, int depthHeight)
        {
            if (pipeline == null)
            {
                return(null);
            }
            if (pipeline.Streams == null)
            {
                return(null);
            }
            if (pipeline.Streams.Count == 0)
            {
                return(null);
            }

            StreamProfile colorProfile = null;
            StreamProfile depthProfile = null;

            foreach (StreamProfile profile in pipeline.Streams)
            {
                VideoStreamProfile videoProfile = profile as VideoStreamProfile;

                if (profile.Stream == Stream.Color && videoProfile.Width == colorWidth && videoProfile.Height == colorHeight)
                {
                    colorProfile = profile;
                }
                else if (profile.Stream == Stream.Depth && videoProfile.Width == depthWidth && videoProfile.Height == depthHeight)
                {
                    depthProfile = profile;
                }
            }

            if (colorProfile == null)
            {
                return(null);
            }
            if (depthProfile == null)
            {
                return(null);
            }

            Intrinsics colorIntrinsics = (colorProfile as VideoStreamProfile).GetIntrinsics();
            Extrinsics colorExtrinsics = colorProfile.GetExtrinsicsTo(depthProfile);
            Intrinsics depthIntrinsics = (depthProfile as VideoStreamProfile).GetIntrinsics();
            Extrinsics depthExtrinsics = depthProfile.GetExtrinsicsTo(colorProfile);

            return(Create(colorIntrinsics, colorExtrinsics, depthIntrinsics, depthExtrinsics));
        }