Skip to content

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

@AmbachtIT

Description

@AmbachtIT

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions