Giter Club home page Giter Club logo

gigevision's Introduction

GigeVision

Simple GigeVision implementation, GVSP, GVCP protocol implemented

How to use:

Get all cameras in the network

var camera = new Camera();
var listOfDevices = await camera.Gvcp.GetAllGigeDevicesInNetworkAsnyc().ConfigureAwait();    

Read Register

var gvcp = new Gvcp();
gvcp.CameraIP = "192.168.10.99";
var reply = await gvcp.ReadRegisterAsync("0x0D04");

Write Register

To write register you must take the control by Writing 0x02 to CCP register, you can write it manually or use the TakeControl Method from library. If succeeded it will give you control for the time that is set in Heartbeat Register, send True as a parameter to keep the control status alive

var gvcp = new Gvcp
{
    CameraIp = "192.168.10.99"
};
if (await gvcp.TakeControl()) //Send True as a parameter to keep alive
{
    var reply = await gvcp.WriteRegisterAsync("0x0D04", 1000);
}
else
{
    throw new Exception("Camera is already in control");
}

Read Memory

var gvcp = new Gvcp();
gvcp.CameraIP = "192.168.10.99";
var reply = await gvcp.ReadMemoryAsync("0x0D04", 500); //To read 500 bytes from memory address 0x0D04

Above mentioned samples are very basic, and in the Gvcp class there are too many method overloads for each function. Link here: https://github.com/Touseefelahi/GigeVision/blob/master/GigeVision.Core/Services/Gvcp.cs

Direct Use for Streaming, For a camera of ip 192.168.10.224 we need to initialize the camera objects as below:

var camera = new Camera("192.168.10.224");

To Receive the stream raw bytes we need to subscribe to the frame ready event, Make sure to have the same interface as the camera, if you have multiple interfaces you need to define it explicitly when starting the stream

camera.FrameReady += FrameReady;

To start the stream we need to call the method StartStream as:

//For multiple interfaces you can define the Rx IP as: (In this example 192.168.10.221 is the PC IP)    
bool isStarted = await camera.StartStreamAsync("192.168.10.221").ConfigureAwait(false);

Once the frame is fully received the FrameReady event will be invoked

private void FrameReady(object sender, byte[] e)
{
  // e contains the raw data in bytes
}

Force IP - In this example we are setting the IP for first detected camera to fix IP to 192.168.10.243

var camera = new Camera();
var listOfDevices = await camera.Gvcp.GetAllGigeDevicesInNetworkAsnyc().ConfigureAwait(true);
if (listOfDevices.Count > 0)
{
    camera.Gvcp.ForceIPAsync(listOfDevices[0].MacAddress, "192.168.10.243");
}

Simple WPF app example is here https://github.com/Touseefelahi/GigeVision/blob/master/GigeVisionLibrary.Test.Wpf/MainWindow.xaml.cs

There are some issues with the namespaces it is conflicting Services and Models, it will be fixed someday

gigevision's People

Contributors

ahbelal avatar dependabot[bot] avatar ellerbach avatar faisalfagihi avatar touseefelahi avatar wag-k avatar

Watchers

 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.