Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/touseefelahi/stira.imagelibrary.wpf

This library have some controls that can display raw bytes or OpenCV Mat as Image in the WPF Image Control
https://github.com/touseefelahi/stira.imagelibrary.wpf

Last synced: 13 days ago
JSON representation

This library have some controls that can display raw bytes or OpenCV Mat as Image in the WPF Image Control

Awesome Lists containing this project

README

        

## Welcome to STIRA Image Library for WPF
This library have a control that can display raw bytes as image int ImageControl
in WPF
### Usage
Set the Resolution of input Image as WidthImage and HeightImage to in Image control.
For grayscall images fill the RawBytes from Row Column (0, 0) to (MaxWidth, MaxHeight).
For colored images set IsColored to true and fill the RawBytes in RGB format.

### Light Image

xmlns:il="clr-namespace:Stira.ImageLibrary.Wpf;assembly=Stira.ImageLibrary.Wpf"

And in the backend we must Update FrameCounter to refresh the image at every new frame
e.g.

public byte[] RawBytes { get; set; }

public int FrameCounter
{
get => frameCounter;
set => SetProperty(ref frameCounter, value);
}

private void FrameReady(byte[] rawBytes)
{
if (rawBytes != null)
{
RawBytes = rawBytes;
RaisePropertyChanged(nameof(RawBytes));
FrameCounter++;
}
}

### Mat Image

xmlns:il="clr-namespace:Stira.ImageLibrary.Wpf;assembly=Stira.ImageLibrary.Wpf"

#### And in the backend we must Update FrameCounter to refresh the image at every new frame e.g.

public StreamViewModel()
{
Camera = new Camera
{
IP = "192.168.10.239"
};
Camera.Updates += StreamUpdates;
Image = new Mat((int)Camera.Height, (int)Camera.Width,
Emgu.CV.CvEnum.DepthType.Cv8U, 1);
RaisePropertyChanged(nameof(Image));
}

public int FrameCounter
{
get => frameCounter;
set => SetProperty(ref frameCounter, value);
}

public Mat Image { get; set; }

private void FrameReady(byte[] rawBytes)
{
if (rawBytes != null)
{
Marshal.Copy(rawBytes, 0, Image.DataPointer, rawBytes.Length);
FrameCounter++; //Change in frameCounter refreshes the Image
}
}