GithubHelp home page GithubHelp logo

osc-net / osc.net Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 0.0 67 KB

.NET Standard Library for Open Spherical Camera API

License: MIT License

C# 100.00%
dotnet camera camera-api 360-photo 360-camera 360-video csharp csharp-library

osc.net's Introduction

NuGet Package

OSC.Net

.NET Standard Library for Open Spherical Camera API 2.0

Example

var cameraClient = new CameraClient();
cameraClient.TakePicture("test.jpg");

Client

The library exposes CameraClient class which implements an ICameraClient interface, which has a set of extension methods on it i.e. TakePicture().

Create client default IP (192.168.42.1) and Port (80)

var cameraClient = new CameraClient();

Create client supply IP and Port

var cameraClient = new CameraClient(new IPEndPoint(IPAddress.Parse("192.168.42.1"), 80));

Create client supply Uri

var cameraClient = new CameraClient(new Uri("http://192.168.42.1"));

HttpClientFactoryHandler

All CameraClient constructors takes an optional HttpClientFactoryHandler createClientparameter which allows you to override how the internally used HttpClient is created.

Example usage with System.Net IHttpClientFactory

var serviceProvider = new ServiceCollection().AddHttpClient().BuildServiceProvider();
            var httpClientFactory = serviceProvider.GetService<IHttpClientFactory>();

var httpClientFactory = serviceProvider.GetService<IHttpClientFactory>();

var cameraClient = new CameraClient(createClient: httpClientFactory.CreateClient);

CreateFileHandler

All CameraClient constructors takes an optional CreateFileHandler createFileparameter which allows you to override how local files are created.

var cameraClient = new CameraClient(
    createFile: path => File.Open(path, FileMode.Create, FileAccess.Write, FileShare.None));

Take Picture

Take picture and get uri to image

var pictureUri = await client.TakePicture();

Take picture and download image to supplied stream

var imageStream = new MemoryStream();
await client.TakePicture(imageStream);

Take picture and save to supplied local path

await client.TakePicture("test.jpg");

useLocalFileUri

All TakePicture methods takes an optional useLocalFileUri bool parameter, by default it's false. If set to true it'll use ICameraClient.EndPoint for construction an absolute uri to images. This is useful if using camera through proxy or firewall.

Supported cameras

This library has been tested with

osc.net's People

Contributors

devlead avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

osc.net's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.