issues
search
SciSharp
/
NumSharp
High Performance Computation for N-D Tensors in .NET, similar API to NumPy.
https://github.com/SciSharp
Apache License 2.0
1.34k
stars
188
forks
source link
Bitmap.ToArray() does not handle images with odd width
#457
Closed
AmbachtIT
closed
7 months ago
AmbachtIT
commented
2 years ago
Reproduction
Have an image with an odd width (for instance: 475x554x3)
Load it into an
NDArray
using
Bitmap.ToNDArray()
;
Expected result
An array with shape (1, 554, 475, 3)
Actual result
throws
IncorrectShapeException
: Given shape size (789450) does not match the size of the given storage size (791112)
Root cause
The method
ToNDArray()
does not handle odd shapes correctly.
Fix
I have been able to reproduce the problem locally and implement a fix. PR will be following shortly.
Image used for reproduction
Reproduction
NDArray
usingBitmap.ToNDArray()
;Expected result
Actual result
IncorrectShapeException
: Given shape size (789450) does not match the size of the given storage size (791112)Root cause
ToNDArray()
does not handle odd shapes correctly.Fix
Image used for reproduction