• Stars
    star
    289
  • Rank 138,109 (Top 3 %)
  • Language
    C#
  • License
    Apache License 2.0
  • Created over 4 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Computer Vision library for C# and F# that combines OpenCV and NDArray together in .NET Standard.

SharpCV

A image library combines OpenCV and NumSharp together. SharpCV returns Mat object with NDArray supported, which makes it easier to do data manipulation like slicing.

Join the chat at https://gitter.im/publiclab/publiclab NuGet

How to use

Install OpenCV prebuild binary

PM> Install-Package SharpCV
PM> Install-Package OpenCvSharp4.runtime.win

Import SharpCV and OpenCV library

using SharpCV;
using static SharpCV.Binding;

Interact with NDArray

NDArray kernel = new float[,]
{
    { 0, -1, 0 },
    { -1, 5, -1 },
    { 0, -1, 0 }
};

var mat = new Mat(kernel);

Assert.AreEqual((3, 3), mat.shape);
Assert.AreEqual(kernel[0], mat.data[0]); // { 0, -1, 0 }
Assert.AreEqual(kernel[1], mat.data[1]); // { -1, 5, -1 }
Assert.AreEqual(kernel[2], mat.data[2]); // { 0, -1, 0 }

Pixel level access

var img = cv2.imread(imgSolar, IMREAD_COLOR.IMREAD_GRAYSCALE);
byte p = img[8, 8];
Assert.AreEqual(18, p);

img = cv2.imread(imgSolar);
var (b, g, r) = img[8, 8];
Assert.AreEqual((32, 19, 11), (b, g, r));

Convert to black and white image

var img = cv2.imread("solar.jpg");
var gray = cv2.cvtColor(img, ColorConversionCodes.COLOR_RGB2GRAY);
var (ret, binary) = cv2.threshold(gray, 0, 255, ThresholdTypes.THRESH_BINARY | ThresholdTypes.THRESH_TRIANGLE);
cv2.imshow("black and white", binary);
cv2.waitKey(0);

Video capture from file or camera

var vid = cv2.VideoCapture("road.mp4");
var (loaded, frame) = vid.read();
while (loaded)
{
    (loaded, frame) = vid.read();
    cv2.imshow("video", frame);
}

If you want to learn more about the API implementation, please refer to the official documentation.

More Repositories

1

TensorFlow.NET

.NET Standard bindings for Google's TensorFlow for developing, training and deploying Machine Learning models in C# and F#.
C#
3,118
star
2

BotSharp

The AI Agent Framework in .NET
C#
1,901
star
3

LLamaSharp

A cross-platform library to run 🦙LLaMA/LLaVA model (and others) on your local device efficiently.
C#
1,805
star
4

NumSharp

High Performance Computation for N-D Tensors in .NET, similar API to NumPy.
C#
1,302
star
5

Numpy.NET

C#/F# bindings for NumPy - a fundamental library for scientific computing, machine learning and AI
C#
640
star
6

Keras.NET

Keras.NET is a high-level neural networks API for C# and F#, with Python Binding and capable of running on top of TensorFlow, CNTK, or Theano.
C#
587
star
7

Pandas.NET

Pandas port for C# and F#, data analysis tool, process multi-dim array in DataFrame.
C#
526
star
8

SiaNet

An easy to use C# deep learning library with CUDA/OpenCL support
C#
376
star
9

SciSharp-Stack-Examples

Practical examples written in SciSharp's machine learning libraries
C#
310
star
10

Torch.NET

.NET bindings for PyTorch. Machine Learning with C# / F# with Multi-GPU/CPU support
C#
270
star
11

Gym.NET

openai/gym's popular toolkit for developing and comparing reinforcement learning algorithms port to C#.
C#
114
star
12

CherubNLP

Natural Language Processing in .NET Core
C#
111
star
13

SciSharp

SciSharp STACK is focused on building tools for Machine Learning development.
Vue
104
star
14

SciSharpCube

Quickly experience all the latest features of SciSharp Machine Learning tools in docker container.
Jupyter Notebook
95
star
15

ICSharpCore

Jupyter kernel in C# .NET Core which is the standard interface for SciSharp STACK.
C#
75
star
16

Bigtree.Algorithm

Machine Learning algorithm library in .NET Core
C#
62
star
17

Plot.NET

.NET wrapper of plotly.js for ICSharpCore
C#
60
star
18

Tensor.NET

A lightweight and high-performance tensor library which provides numpy-like operations but .NET style interfaces. It supports generic tensor, Linq, C# native slices and so on. (Qushui student project))
C#
60
star
19

Matplotlib.Net

.NET wrapper for the Python plotting library Matplotlib
C#
47
star
20

dotnet-mysql-replication

C# Implementation of MySQL replication protocol
C#
45
star
21

BotSharp-UI

Build, test and manage your AI Agents in the central place.
SCSS
40
star
22

scikit-learn.net

Machine Learning in .NET Core.
C#
37
star
23

CodeMinion

A code generator framework capable of auto-generating the APIs of several SciSharp libraries.
C#
34
star
24

OpenAIGym.NET

A toolkit for developing and comparing reinforcement learning algorithms.
C#
26
star
25

Ludwig.NET

Ludwig is a toolbox that allows to train and test deep learning models without the need to write code.
C#
26
star
26

SciSharp.Models

Image Classification, Time Series, Transformer, Object Detection
Jupyter Notebook
22
star
27

protobuf.Text

Text format support for protobuf
C#
21
star
28

Microcharts.Matplotlib

Microcharts.Matplotlib is a wrapper of Microcharts for Data Science and Machine Learning
C#
21
star
29

SharpPythonCompiler

A compiler which can transform the convention of C# code to the convention of Python
C#
20
star
30

SpaCy.NET

.NET wrapper of spaCy (Industrial-strength NLP)
18
star
31

tensorflow-net-docs

Tensorflow.NET documentation
C#
16
star
32

unity-ml-agents.net

C#
15
star
33

NumSharp.Lite

NumSharp compact version without full datatype supported.
C#
10
star
34

TensorFlow.NET.OpencvAdapter

A library which enables using tensorflow.net with opencvsharp. It reuses the memory to provide a good performance.
C#
9
star
35

PillowSharp

The friendly PIL fork (Python Imaging Library) in C#.
9
star
36

SciSharpStudio

SciSharp Studio is a web based AI/ ML development tool.
HTML
6
star
37

qdrant-csharp

Qdrant .NET Client
C#
5
star
38

TensorDebuggerVisualizers

The Sheet Viewer, which provides instant view of the contents of the sheet when debugging.
C#
4
star
39

ChillXML

2
star