Skip to content

Commit

Permalink
Added get image methods
Browse files Browse the repository at this point in the history
  • Loading branch information
mkholghi committed Aug 1, 2018
1 parent 9cf361c commit 918b8b3
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/AudioAnalysisTools/StandardSpectrograms/SpectrogramTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace AudioAnalysisTools.StandardSpectrograms
using Acoustics.Shared;
using ColorMine.ColorSpaces;
using DSP;
using LongDurationSpectrograms;
using TowseyLibrary;

public static class SpectrogramTools
Expand Down Expand Up @@ -839,5 +840,33 @@ public static void DrawTimeLinesOnImage(Bitmap bmp, TimeSpan startOffset, TimeSp
// #######################################################################################################################################
// ### ABOVE METHODS DRAW TIME GRID LINES ON SPECTROGRAMS ####################################################################################
// #######################################################################################################################################


public static Image GetImageFullyAnnotated(Image image, string title, int[,] gridLineLocations, TimeSpan duration)
{
if (image == null)
{
throw new ArgumentNullException(nameof(image));
}

FrequencyScale.DrawFrequencyLinesOnImage((Bitmap)image, gridLineLocations, includeLabels: true);

var titleBar = LDSpectrogramRGB.DrawTitleBarOfGrayScaleSpectrogram(title, image.Width);
var timeBmp = ImageTrack.DrawTimeTrack(duration, image.Width);
var list = new List<Image> { titleBar, timeBmp, image, timeBmp };
var compositeImage = ImageTools.CombineImagesVertically(list);
return compositeImage;
}

public static Image GetImage(double[,] data, int nyquist, bool DoMel)
{
int subBandMinHz = 1000;
int subBandMaxHz = 9000;
bool doHighlightSubband = false;

int maxFrequency = nyquist;
var image = BaseSonogram.GetSonogramImage(data, nyquist, maxFrequency, DoMel, 1, doHighlightSubband, subBandMinHz, subBandMaxHz);
return image;
}
}
}

0 comments on commit 918b8b3

Please sign in to comment.