You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NumSharp's core functionality can be extended with additional packages that integrate with platform-specific features or external libraries.
3
+
NumSharp is designed to integrate with the broader .NET ecosystem. Extension packages bridge NumSharp arrays with platform-specific features and external libraries.
4
4
5
-
---
5
+
## Official Extensions
6
6
7
-
## Available Extensions
7
+
| Package | Purpose |
8
+
|---------|---------|
9
+
|[NumSharp.Bitmap](bitmap.md)| Image ↔ NDArray conversion via `System.Drawing`|
8
10
9
-
| Package | Description | Platform |
10
-
|---------|-------------|----------|
11
-
|[NumSharp.Bitmap](bitmap.md)| Convert between `System.Drawing.Bitmap` and `NDArray`| Windows |
11
+
## Build Your Own
12
12
13
-
---
14
-
15
-
## NumSharp.Bitmap
16
-
17
-
Seamless image-to-array conversion for image processing and ML workflows.
<p>NumSharp is designed to integrate with the broader .NET ecosystem. Extension packages bridge NumSharp arrays with platform-specific features and external libraries.</p>
"summary": "Extending Libraries NumSharp's core functionality can be extended with additional packages that integrate with platform-specific features or external libraries. Available Extensions Package Description Platform NumSharp.Bitmap Convert between System.Drawing.Bitmap and NDArray Windows NumSharp.Bitmap Seamless image-to-array conversion for image processing and ML workflows. using System.Drawing; using NumSharp; // Image → Array var bitmap = new Bitmap(\"photo.jpg\"); var pixels = bitmap.ToNDArray(); // (1, height, width, channels) // Process pixels with NumSharp operations... // Array → Image var result = processedPixels.ToBitmap(); result.Save(\"output.jpg\"); Key Features: Zero-copy mode for performance-critical code Supports 24bpp and 32bpp images Alpha channel handling Round-trip support (load → process → save) Full documentation → Installing Extensions Extensions are separate NuGet packages: # Core library (always required) dotnet add package NumSharp # Extensions (optional, add as needed) dotnet add package NumSharp.Bitmap Creating Your Own Extensions NumSharp is designed to be extensible. The key integration points: Working with NDArray Memory // Get raw pointer to contiguous data unsafe { byte* ptr = (byte*)ndarray.Unsafe.Address; // Use with P/Invoke, native libraries, etc. } Creating NDArray from External Memory // Wrap existing unmanaged memory as NDArray unsafe { var slice = new ArraySlice<byte>( new UnmanagedMemoryBlock<byte>(ptr, length, disposeCallback) ); var nd = new NDArray(slice); } Extension Method Pattern Follow the NumSharp.Bitmap pattern for consistent API: public static class YourExtensions { public static NDArray ToNDArray(this YourType source, ...) { // Convert to NDArray } public static YourType ToYourType(this NDArray nd, ...) { // Convert from NDArray } }"
480
+
"summary": "Extending Libraries NumSharp is designed to integrate with the broader .NET ecosystem. Extension packages bridge NumSharp arrays with platform-specific features and external libraries. Official Extensions Package Purpose NumSharp.Bitmap Image ↔ NDArray conversion via System.Drawing Build Your Own NumSharp exposes low-level memory access for integration with native libraries, GPU frameworks, or domain-specific formats: // Access raw memory for interop byte* ptr = (byte*)ndarray.Unsafe.Address; // Wrap external memory as NDArray var nd = new NDArray(new ArraySlice<byte>( new UnmanagedMemoryBlock<byte>(ptr, length, onDispose) )); Have an extension to share? Open a PR to add it to this list."
0 commit comments