Giter Site home page Giter Site logo

imclab / unity3d-cameraopticalflow Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bonjour-interactive-lab/unity3d-cameraopticalflow

0.0 0.0 0.0 241 KB

GPU Optical Flow on camera (webcam, kinect, Black Magic...)

License: GNU General Public License v3.0

C# 52.52% ShaderLab 27.52% HLSL 19.97%

unity3d-cameraopticalflow's Introduction

Unity3D-CameraOpticalFlow

gif

CameraOpticalFlow is a GPU based optical flow system for unity.

OpticalFlow.cs

This script computes an optical flow on GPU side. It takes a RenderTexture as an input to analyze. The result is returned as a RenderTexture in an ARGBFloat format. You can grab the RenderTexture containing the OF from script by calling OpticalFlow.GetOpticalFlowMap()

OFTrailSystemUpdater.cs

This script compute an history trail from the optical flow. It grab the result from OpticalFlow.cs The results is return as a CustomRenderTexture in an ARGBFloat format. You could get the result of the OF from script by calling OFTrailSystemUpdater.GetOFTrail()

AverageVelocity.cs

This script compute the average velocity from the OF texture. Please note: this computation can be pretty intensive as it loop over all the pixel of the image. Use it with a lower resolution defined by the var resolution The result can be grab using AverageVelocity.GetAverageVelocity() The AverageVelocity.GetAverageVelocity() function return a Vector3 discribing the average velocity in XY component and the max magnitude in the Z component (if needed for normalization)

Install Package

This package uses the scoped registry feature to import dependent packages. Please add the following sections to the package manifest file (Packages/manifest.json).

To the scopedRegistries section:

{
    "name": "Bonjour-lab",
    "url": "https://registry.npmjs.com",
    "scopes": [
    "com.bonjour-lab"
    ]
}

To the dependencies section:

"com.bonjour-lab.opticalflow": "1.0.3",

After changes, the manifest file should look like below:

{
  "scopedRegistries": [
    {
      "name": "Bonjour-lab",
      "url": "https://registry.npmjs.com",
      "scopes": [
        "com.bonjour-lab"
      ]
    }
  ],
  "dependencies": {
    "com.bonjour-lab.opticalflow": "1.0.3",
    ...

Tested on

  • Unity 2020 & 2019

unity3d-cameraopticalflow's People

Contributors

alexr4 avatar

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.