From 3a8eefc5cd465d9c4265c183b4bef3f1a9bcc04a Mon Sep 17 00:00:00 2001
From: truebigsand <64719990+truebigsand@users.noreply.github.com>
Date: Thu, 12 Sep 2024 22:33:42 +0800
Subject: [PATCH] Fix: #1698 fix length of Mat.AsSpan()
---
src/OpenCvSharp/Modules/core/Mat/Mat.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/OpenCvSharp/Modules/core/Mat/Mat.cs b/src/OpenCvSharp/Modules/core/Mat/Mat.cs
index 544acc363..86ccb9435 100644
--- a/src/OpenCvSharp/Modules/core/Mat/Mat.cs
+++ b/src/OpenCvSharp/Modules/core/Mat/Mat.cs
@@ -4161,8 +4161,8 @@ public void ForEachAsVec6d(MatForeachFunctionVec6d operation)
///
///
///
- public unsafe Span AsSpan() where T : unmanaged
- => IsContinuous() ? new Span(DataPointer, (int)Total()) : [];
+ public unsafe Span AsSpan() where T : unmanaged
+ => IsContinuous() ? new Span(DataPointer, (int)Total() * ElemSize() / sizeof(T)) : [];
#endregion
}