public static Image <Rgb24> FrameSliceOf3DSpectrogram_DayOfYear(Image <Rgb24> bmp1, Image <Rgb24> titleBar, int year, int dayOfYear, TimeSpan xInterval, int herzValue, FileInfo sunriseSetData, int nyquistFreq) { Image <Rgb24> suntrack = SunAndMoon.AddSunTrackToImage(bmp1.Width, sunriseSetData, year, dayOfYear); bmp1.Mutate(g => { Pen pen = new Pen(Color.White, 1); var stringFont = Drawing.Arial12; //Font stringFont = Drawing.Tahoma9; DateTime theDate = new DateTime(year, 1, 1).AddDays(dayOfYear - 1); string dateString = $"{year} {DataTools.MonthNames[theDate.Month - 1]} {theDate.Day:d2}"; g.DrawText(dateString, stringFont, Color.Wheat, new PointF(10, 3)); }); TimeSpan xAxisPixelDuration = TimeSpan.FromSeconds(60); var minuteOffset = TimeSpan.Zero; double secondsDuration = xAxisPixelDuration.TotalSeconds * bmp1.Width; TimeSpan fullDuration = TimeSpan.FromSeconds(secondsDuration); // init frequency scale int herzInterval = 1000; int frameSize = bmp1.Height; var freqScale = new DSP.FrequencyScale(nyquistFreq, frameSize, herzInterval); SpectrogramTools.DrawGridLinesOnImage((Image <Rgb24>)bmp1, minuteOffset, fullDuration, xInterval, freqScale); int trackHeight = 20; int imageHt = bmp1.Height + trackHeight + trackHeight + trackHeight; var xAxisTicInterval = TimeSpan.FromMinutes(60); // assume 60 pixels per hour var timeScale24Hour = ImageTrack.DrawTimeTrack(fullDuration, minuteOffset, xAxisTicInterval, bmp1.Width, trackHeight, "hours"); var imageList = new List <Image <Rgb24> > { titleBar, timeScale24Hour, suntrack, bmp1, timeScale24Hour }; var compositeBmp = ImageTools.CombineImagesVertically(imageList); // trackHeight = compositeBmp.Height; // Image<Rgb24> timeScale12Months = ImageTrack.DrawYearScaleVertical(40, trackHeight); // Image<Rgb24> freqScale = DrawFreqScale_vertical(40, trackHeight, HerzValue, nyquistFreq); imageList = new List <Image <Rgb24> >(); // imageList.Add(timeScale12Months); imageList.Add(compositeBmp); // imageList.Add(freqScale); compositeBmp = ImageTools.CombineImagesInLine(imageList.ToArray()); return(compositeBmp); }
public static Image FrameSliceOf3DSpectrogram_DayOfYear(Image bmp1, Image titleBar, int year, int dayOfYear, TimeSpan xInterval, int herzValue, FileInfo sunriseSetData, int nyquistFreq) { Bitmap suntrack = SunAndMoon.AddSunTrackToImage(bmp1.Width, sunriseSetData, year, dayOfYear); Graphics g = Graphics.FromImage(bmp1); Pen pen = new Pen(Color.White); Font stringFont = new Font("Arial", 12); //Font stringFont = new Font("Tahoma", 9); DateTime theDate = new DateTime(year, 1, 1).AddDays(dayOfYear - 1); string dateString = string.Format("{0} {1} {2:d2}", year, DataTools.MonthNames[theDate.Month - 1], theDate.Day); g.DrawString(dateString, stringFont, Brushes.Wheat, new PointF(10, 3)); TimeSpan xAxisPixelDuration = TimeSpan.FromSeconds(60); var minuteOffset = TimeSpan.Zero; double secondsDuration = xAxisPixelDuration.TotalSeconds * bmp1.Width; TimeSpan fullDuration = TimeSpan.FromSeconds(secondsDuration); // init frequency scale int herzInterval = 1000; int frameSize = bmp1.Height; var freqScale = new DSP.FrequencyScale(nyquistFreq, frameSize, herzInterval); SpectrogramTools.DrawGridLinesOnImage((Bitmap)bmp1, minuteOffset, fullDuration, xInterval, freqScale); int trackHeight = 20; int imageHt = bmp1.Height + trackHeight + trackHeight + trackHeight; var xAxisTicInterval = TimeSpan.FromMinutes(60); // assume 60 pixels per hour var timeScale24Hour = ImageTrack.DrawTimeTrack(fullDuration, minuteOffset, xAxisTicInterval, bmp1.Width, trackHeight, "hours"); var imageList = new List <Image>(); imageList.Add(titleBar); imageList.Add(timeScale24Hour); imageList.Add(suntrack); imageList.Add(bmp1); imageList.Add(timeScale24Hour); Image compositeBmp = ImageTools.CombineImagesVertically(imageList.ToArray()); // trackHeight = compositeBmp.Height; // Bitmap timeScale12Months = ImageTrack.DrawYearScaleVertical(40, trackHeight); // Bitmap freqScale = DrawFreqScale_vertical(40, trackHeight, HerzValue, nyquistFreq); imageList = new List <Image>(); // imageList.Add(timeScale12Months); imageList.Add(compositeBmp); // imageList.Add(freqScale); compositeBmp = ImageTools.CombineImagesInLine(imageList.ToArray()); return(compositeBmp); }
public static Image FrameSliceOf3DSpectrogram_ConstantFreq(Image bmp1, Image titleBar, TimeSpan xInterval, int herzValue, FileInfo sunriseSetData, int nyquistFreq) { SunAndMoon.AddSunRiseSetLinesToImage((Bitmap)bmp1, sunriseSetData, 0, 365, 1); // assume full year and 1px/day var g = Graphics.FromImage(bmp1); var pen = new Pen(Color.White); var stringFont = new Font("Arial", 12); var str = $"Freq = {herzValue} Hz"; g.DrawString(str, stringFont, Brushes.Wheat, new PointF(10, 7)); var xAxisPixelDuration = TimeSpan.FromSeconds(60); var startOffset = TimeSpan.Zero; double secondsDuration = xAxisPixelDuration.TotalSeconds * bmp1.Width; var fullDuration = TimeSpan.FromSeconds(secondsDuration); // init frequency scale int herzInterval = 1000; int frameSize = bmp1.Height; var freqScale = new DSP.FrequencyScale(nyquistFreq, frameSize, herzInterval); SpectrogramTools.DrawGridLinesOnImage((Bitmap)bmp1, startOffset, fullDuration, xInterval, freqScale); int trackHeight = 20; var xAxisTicInterval = TimeSpan.FromMinutes(60); // assume 60 pixels per hour var timeScale24Hour = ImageTrack.DrawTimeTrack(fullDuration, startOffset, xAxisTicInterval, bmp1.Width, trackHeight, "hours"); var imageList = new List <Image> { titleBar, timeScale24Hour, bmp1, timeScale24Hour }; var compositeBmp = ImageTools.CombineImagesVertically(imageList.ToArray()); if (compositeBmp == null) { throw new ArgumentNullException(nameof(compositeBmp)); } trackHeight = compositeBmp.Height; Bitmap timeScale12Months = ImageTrack.DrawYearScaleVertical(40, trackHeight); Bitmap freqScaleImage = DrawFreqScale_vertical(40, trackHeight, herzValue, nyquistFreq); imageList = new List <Image> { timeScale12Months, compositeBmp, freqScaleImage }; compositeBmp = ImageTools.CombineImagesInLine(imageList.ToArray()); return(compositeBmp); }