SciSharp/NumSharp

Bitmap.ToArray() does not handle images with odd width

AmbachtIT opened this issue · 0 comments

Reproduction

  1. Have an image with an odd width (for instance: 475x554x3)
  2. 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

odd-width