Git Product home page Git Product logo

thetanetcore's Introduction

ThetaNetCore

.NET Library for controlling Ricoh Theta Cameras

This library is build base on the API specification provided by Ricoh. If you are not clear about the details, you may check their web page. API v2 Reference

The library is written with .Net Standard 2.0, so it should work for other OS using Xamarin.

Architecture

ThetaWifiApi is almost direct translations of API specification. If you know enough about the THETA API, instantiate this class and use it. This class is basically do the network communication and JSON data handling.

For most of you will use the ThetaWifiConnect. It is a wrapper of the THETA API to make complicated task simple, which involves several set of calls. If you need tasks that are not wrapped by the class, you retrieve ThetaWifiApi from the instance.

Classes in Wifi\Request and Wifi\Respond directory are self explanetory. They are direct conversion of JSON data to C# object.

How to use

  1. Declare an instance of ThetaWifiConnect.

    ThetaWifiConnect _theta = new ThetaWifiConnect();
    
  2. You may register some listeners

    _theta.ImageReady += ThetaApi_ImageReady;
    _theta.OnTakePictureCompleted += ThetaApi_OnTakePictureCompleted;
    _theta.OnTakePictureFailed += ThetaApi_OnTakePictureFailed;
    
  3. This one checks if the connecion is ready

    await _theta.CheckConnection();
    
  4. Get the information of the camera

    var info = await _theta.ThetaApi.InfoAsync();
    

    Notice that getting information is a simple single call, so we retrieve the ThetaApi and operates on it.

  5. Get the status of the camera

    var status = await _theta.ThetaApi.StateAsync();
    

    'status' holds everything

  6. When you start preview

    _theta.StartLivePreview();
    

    ImageReady events are called many times. It's a Jpeg format. Beware that it is not an UI thread.

    private void ThetaApi_ImageReady(byte[] imgByteArray)
    {
        // JPEG format data
        this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate
        {
            try
            {
                var source = LoadImage(imgByteArray);
                imgPreview.Source = source;
            }
            catch (Exception ex)
            {
                HandleException(ex);
            }
    
        }));
    }
    

    Stop previewing.

    _theta.StopLivePreview();
    
  7. Taking picture is also simple.

    await _theta.TakePictureAsync();
    

    When succeeded, completed event will be called.

    private void ThetaApi_OnTakePictureCompleted(string fileName)
    {
        ...
    }
    

    And if it failed, failed event will be called.

    private void ThetaApi_OnTakePictureFailed(Exception ex)
    {
        ...
    }
    
  8. Use SetOptions to configuring camera settings

    var options = new OptionValues();
    options.PreviewFormat = new PreviewFormat(){ Width=1920, Height=960, Framerate=8 };
    await _theta.ThetaApi.SetOptionsAsync(options);
    
    

    Set values that you are updating only.

NOTE

  • When you initiate Taking picture action, any other API call will fail until its processing ends. Wait for a success or fail notification before calling other APIs.

Version History

1.0.0 initial release

1.0.1
Fixes:

  • App crashed when change the preview format
  • Preview stopped working after taking pictures
  • Download progress was not shown
  • Internally, changed the way accessing THETA to recommended way.+

1.1.0
New:

  • Migrated to .Net Core projects

Fixes

  • A lot of small fixes

ThetaNetCoreApp

Windows implementaion of Theta application. It is written with WPF. You will see more examples of how you should implement.

Classes under the "Controls/Camera" folder are the ones interacting with THETA camera.

Start page is like this App Home

You need to check connection. Once connection is confirmed, you can take pictures and download them. App Home

You can browse pictures in your camera and PC. App Home

And the 360 image viewer. App Home

thetanetcore's People

Contributors

rysaproject avatar

Stargazers

 avatar  avatar  avatar  avatar

Forkers

lusiz90

thetanetcore'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.