Camera settings
This commit is contained in:
parent
6fed61be4a
commit
93e692df9e
@ -8,9 +8,16 @@ namespace Squirrowse.Client.Service
|
||||
{
|
||||
public class CameraService : ICameraService
|
||||
{
|
||||
public VideoCapture GetCamera()
|
||||
public VideoCapture GetCamera(int height=480,int widght=640,double fps=15f,bool disposable = false)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
var cam = new VideoCapture(CaptureDevice.Any);
|
||||
cam.Fps = fps;
|
||||
cam.FrameHeight = height;
|
||||
cam.FrameWidth = widght;
|
||||
cam.IsEnabledDispose = disposable;
|
||||
|
||||
return cam;
|
||||
}
|
||||
|
||||
public Task<Mat> GetFrame(VideoCapture video)
|
||||
|
@ -8,7 +8,7 @@ namespace Squirrowse.Client.Service
|
||||
{
|
||||
public interface ICameraService
|
||||
{
|
||||
public VideoCapture GetCamera();
|
||||
public VideoCapture GetCamera(int height = 480, int widght = 640, double fps = 15f, bool disposable = false);
|
||||
public Task<Mat> GetFrame(VideoCapture video);
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ namespace Squirrowse.Client.Service
|
||||
public interface IStreamService
|
||||
{
|
||||
Task SendStreamAsync(IAsyncEnumerable<byte[]> asb);
|
||||
|
||||
Task SayHello();
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
using Microsoft.AspNetCore.SignalR.Client;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Squirrowse.Core.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
@ -11,27 +12,38 @@ namespace Squirrowse.Client.Service
|
||||
{
|
||||
private readonly IConnectionManager connectionManager;
|
||||
private readonly ILogger<StreamService> logger;
|
||||
|
||||
private readonly HubConnection session;
|
||||
public StreamService(ILogger<StreamService> logger, IConnectionManager connectionManager)
|
||||
{
|
||||
this.connectionManager = connectionManager;
|
||||
this.logger = logger;
|
||||
session = connectionManager.Connect();
|
||||
session.StartAsync().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public async Task SayHello()
|
||||
{
|
||||
try
|
||||
{
|
||||
await session.SendAsync("AddToGroup",Groups.debug);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public async Task SendStreamAsync(IAsyncEnumerable<byte[]> asb)
|
||||
{
|
||||
var con = connectionManager.Connect();
|
||||
try
|
||||
{
|
||||
logger.LogInformation($"{nameof(SendStreamAsync)} Start stream");
|
||||
await con.StartAsync();
|
||||
await con.SendAsync("UploadByteStream", asb, default);
|
||||
await session.SendAsync("UploadByteStream", asb, default);
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
logger.LogInformation($"{nameof(SendStreamAsync)} End stream");
|
||||
await con.StopAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,4 +11,8 @@
|
||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="3.0.0" />
|
||||
<PackageReference Include="OpenCvSharp4.Windows" Version="4.1.1.20191021" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Squirrowse.Core\Squirrowse.Core.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
Loading…
Reference in New Issue
Block a user