{"id":28639391,"url":"https://github.com/scisharp/sharpcv","last_synced_at":"2025-06-12T19:40:24.374Z","repository":{"id":37405555,"uuid":"230183535","full_name":"SciSharp/SharpCV","owner":"SciSharp","description":"A Computer Vision library for C# and F# that combines OpenCV and NDArray together in .NET Standard.","archived":false,"fork":false,"pushed_at":"2023-11-06T00:56:31.000Z","size":1714,"stargazers_count":299,"open_issues_count":18,"forks_count":56,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-06-11T19:53:14.366Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SciSharp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-12-26T02:49:23.000Z","updated_at":"2025-06-08T12:42:14.000Z","dependencies_parsed_at":"2023-02-09T14:32:17.823Z","dependency_job_id":"3490bf65-849e-4e9c-a089-1a4bd4c5b009","html_url":"https://github.com/SciSharp/SharpCV","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SciSharp/SharpCV","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SciSharp%2FSharpCV","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SciSharp%2FSharpCV/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SciSharp%2FSharpCV/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SciSharp%2FSharpCV/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SciSharp","download_url":"https://codeload.github.com/SciSharp/SharpCV/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SciSharp%2FSharpCV/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259520285,"owners_count":22870415,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-12T19:40:23.613Z","updated_at":"2025-06-12T19:40:24.360Z","avatar_url":"https://github.com/SciSharp.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SharpCV\n\nA image library combines [OpenCV](https://github.com/opencv/opencv) and [NumSharp](https://github.com/SciSharp/NumSharp.Lite) together. `SharpCV` returns `Mat` object with `NDArray` supported, which makes it easier to do data manipulation like slicing.\n\n[![Join the chat at https://gitter.im/publiclab/publiclab](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/sci-sharp/community) [![NuGet](https://img.shields.io/nuget/dt/SharpCV.svg)](https://www.nuget.org/packages/SharpCV)\n\n### How to use\n\nInstall OpenCV prebuild binary\n\n```powershell\nPM\u003e Install-Package SharpCV\nPM\u003e Install-Package OpenCvSharp4.runtime.win\n```\nImport SharpCV and OpenCV library\n```csharp\nusing SharpCV;\nusing static SharpCV.Binding;\n```\nInteract with `NDArray`\n\n```csharp\nNDArray kernel = new float[,]\n{\n    { 0, -1, 0 },\n    { -1, 5, -1 },\n    { 0, -1, 0 }\n};\n\nvar mat = new Mat(kernel);\n\nAssert.AreEqual((3, 3), mat.shape);\nAssert.AreEqual(kernel[0], mat.data[0]); // { 0, -1, 0 }\nAssert.AreEqual(kernel[1], mat.data[1]); // { -1, 5, -1 }\nAssert.AreEqual(kernel[2], mat.data[2]); // { 0, -1, 0 }\n```\n\nPixel level access\n\n```csharp\nvar img = cv2.imread(imgSolar, IMREAD_COLOR.IMREAD_GRAYSCALE);\nbyte p = img[8, 8];\nAssert.AreEqual(18, p);\n\nimg = cv2.imread(imgSolar);\nvar (b, g, r) = img[8, 8];\nAssert.AreEqual((32, 19, 11), (b, g, r));\n```\n\nConvert to black and white image\n\n```csharp\nvar img = cv2.imread(\"solar.jpg\");\nvar gray = cv2.cvtColor(img, ColorConversionCodes.COLOR_RGB2GRAY);\nvar (ret, binary) = cv2.threshold(gray, 0, 255, ThresholdTypes.THRESH_BINARY | ThresholdTypes.THRESH_TRIANGLE);\ncv2.imshow(\"black and white\", binary);\ncv2.waitKey(0);\n```\nVideo capture from file or camera\n```csharp\nvar vid = cv2.VideoCapture(\"road.mp4\");\nvar (loaded, frame) = vid.read();\nwhile (loaded)\n{\n    (loaded, frame) = vid.read();\n    cv2.imshow(\"video\", frame);\n}\n```\n\nIf you want to learn more about the API implementation, please refer to the official [documentation](https://docs.opencv.org/).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscisharp%2Fsharpcv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscisharp%2Fsharpcv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscisharp%2Fsharpcv/lists"}