Skip to content
Projets

À propos

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

IA et apprentissage automatique

Comment ces chiffres sont mesurés

Progression mesurée des étoiles

in 24h
0
in 7 days
0
in 15 days
+1
in 1 month
Historique en cours

Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.

README.md

Original

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.

Explorer des projets similaires

Chargement…