Exemple #1
0
        /// <summary>
        /// This method assumes that the height of the passed sonogram image is half of the original frame size.
        /// This assumption allows the frequency scale grid lines to be placed at the correct intervals.
        /// </summary>
        public static Image FrameSonogram(
            Image sonogramImage,
            Image titleBar,
            TimeSpan minuteOffset,
            TimeSpan xAxisTicInterval,
            TimeSpan xAxisPixelDuration,
            TimeSpan labelInterval,
            int nyquist,
            int hertzInterval)
        {
            double secondsDuration = xAxisPixelDuration.TotalSeconds * sonogramImage.Width;
            var    fullDuration    = TimeSpan.FromSeconds(secondsDuration);

            // init frequency scale
            int frameSize = sonogramImage.Height * 2;
            var freqScale = new FrequencyScale(nyquist, frameSize, hertzInterval);

            SpectrogramTools.DrawGridLinesOnImage((Bitmap)sonogramImage, minuteOffset, fullDuration, xAxisTicInterval, freqScale);

            int imageWidth = sonogramImage.Width;
            var timeBmp    = ImageTrack.DrawShortTimeTrack(minuteOffset, xAxisPixelDuration, xAxisTicInterval, labelInterval, imageWidth, "Seconds");

            Image[] imageArray = { titleBar, timeBmp, sonogramImage, timeBmp };
            return(ImageTools.CombineImagesVertically(imageArray));
        }
Exemple #2
0
        /// <summary>
        /// This method draws only top and bottom time scales and adds the title bar.
        /// It does NOT include the frequency grid lines.
        /// </summary>
        public static Image <Rgb24> FrameSonogram(
            Image <Rgb24> sonogramImage,
            Image <Rgb24> titleBar,
            TimeSpan minuteOffset,
            TimeSpan xAxisTicInterval,
            TimeSpan xAxisPixelDuration,
            TimeSpan labelInterval)
        {
            int imageWidth = sonogramImage.Width;
            var timeBmp    = ImageTrack.DrawShortTimeTrack(minuteOffset, xAxisPixelDuration, xAxisTicInterval, labelInterval, imageWidth, "Seconds");

            return(ImageTools.CombineImagesVertically(titleBar, timeBmp, sonogramImage, timeBmp));
        }