Skip to content

Commit

Permalink
Merge pull request #1703 from truebigsand/main
Browse files Browse the repository at this point in the history
Fix: #1698 fix length of Mat.AsSpan()
  • Loading branch information
shimat authored Oct 24, 2024
2 parents 654488b + 3a8eefc commit 02b7ec7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/OpenCvSharp/Modules/core/Mat/Mat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4161,8 +4161,8 @@ public void ForEachAsVec6d(MatForeachFunctionVec6d operation)
/// </summary>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
public unsafe Span<T> AsSpan<T>() where T : unmanaged
=> IsContinuous() ? new Span<T>(DataPointer, (int)Total()) : [];
public unsafe Span<T> AsSpan<T>() where T : unmanaged
=> IsContinuous() ? new Span<T>(DataPointer, (int)Total() * ElemSize() / sizeof(T)) : [];

#endregion
}

0 comments on commit 02b7ec7

Please sign in to comment.