mirror of
https://github.com/unclshura/splitter.git
synced 2026-06-22 00:22:01 +00:00
25 lines
523 B
C#
25 lines
523 B
C#
using OpenCvSharp;
|
|
using splitter.algo;
|
|
|
|
namespace Splitter_UI.Services;
|
|
|
|
public class SingleThreadedDetector<T>(IObjectDetector _detector) : IObjectDetector
|
|
where T : IObjectDetector
|
|
{
|
|
private Lock _lock = new();
|
|
|
|
public List<(OpenCvSharp.Rect box, Point2f center)> DetectAll(Mat frameCont)
|
|
{
|
|
lock (_lock)
|
|
{
|
|
return _detector.DetectAll(frameCont);
|
|
}
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
if ( _detector is IDisposable d )
|
|
d.Dispose();
|
|
}
|
|
}
|