-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #297
- Loading branch information
Showing
5 changed files
with
277 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// <copyright file="PointData.cs" company="QutEcoacoustics"> | ||
// All code in this file and all associated files are the copyright and property of the QUT Ecoacoustics Research Group (formerly MQUTeR, and formerly QUT Bioacoustics Research Group). | ||
// </copyright> | ||
|
||
namespace AudioAnalysisTools | ||
{ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using AudioAnalysisTools.Events.Drawing; | ||
using SixLabors.ImageSharp; | ||
using SixLabors.ImageSharp.Processing; | ||
|
||
public class PointData | ||
{ | ||
public ISet<ISpectralPoint> Points { get; } | ||
|
||
public void DrawPointsAsFill(IImageProcessingContext graphics, EventRenderingOptions options) | ||
{ | ||
// overlay point data on image with 50% opacity | ||
// TODO: a much more efficient implementation exists if we derive from Region and convert | ||
// our set<points> to a region. | ||
foreach (var point in this.Points) | ||
{ | ||
var area = options.Converters.GetPixelRectangle(point); | ||
graphics.Fill(options.Fill, area); | ||
} | ||
} | ||
|
||
public void DrawPointsAsPath(IImageProcessingContext graphics, EventRenderingOptions options) | ||
{ | ||
// visits each point once | ||
// assumes each point describes a line | ||
// assumes a SortedSet is used (and that iteration order is signficant, unlike with HashSet) | ||
var path = this.Points.Select(x => options.Converters.GetPoint(x)).ToArray(); | ||
|
||
// note not using AA here | ||
// note could base pen thickness off ISpectralPoint thickness for a more accurate representation | ||
graphics.DrawLines( | ||
options.Border, | ||
path); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// <copyright file="LinearSecondsScale.cs" company="QutEcoacoustics"> | ||
// All code in this file and all associated files are the copyright and property of the QUT Ecoacoustics Research Group (formerly MQUTeR, and formerly QUT Bioacoustics Research Group). | ||
// </copyright> | ||
|
||
namespace AudioAnalysisTools.Scales | ||
{ | ||
using System; | ||
|
||
/// <summary> | ||
/// This class converts between frames and time duration in seconds. | ||
/// A complication arises when the frames of a spectrogram are overlapped. | ||
/// </summary> | ||
public class LinearSecondsScale | ||
{ | ||
public LinearSecondsScale(int sampleRate, int frameSize, int stepSize) | ||
{ | ||
this.SecondsPerFrame = frameSize / (double)sampleRate; | ||
this.SecondsPerFrameStep = stepSize / (double)sampleRate; | ||
} | ||
|
||
public double SecondsPerFrame { get; } | ||
|
||
public double SecondsPerFrameStep { get; } | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.