SciSharp / SciSharp/NumSharp

NDArray.ToBitmap() has critical issue with 24bpp VERTICAL images

Open
#440 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C#
Stars
1.5k
Forks
205
Avg merge
7d 7h
Merged PRs (30d)
2

Description

        var arr = np.ones(1, 2, 1, 3).astype(NPTypeCode.Byte);
        var bmp = arr.ToBitmap();

        for (int c = 0; c < bmp.Width; c++)
        {
            for (int r = 0; r < bmp.Height; r++)
            {
                var p = bmp.GetPixel(c, r);
                Console.WriteLine($"r:{r} c:{c} => ({p.R};{p.G};{p.B})");
            }
        }

        // return
        // r: 0 c: 0 => (1; 1; 1)
        // r: 1 c: 0 => (0; 1; 1) !!!

        // instead of
        // r: 0 c: 0 => (1; 1; 1)
        // r: 1 c: 0 => (1; 1; 1)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the implementation of NDArray.ToBitmap() and reproduce the issue with the provided 1x2x1x3 array and pixel loop. Verify the vertical 24bpp output against the expected values, then add or update coverage for this case so both pixels retain RGB values of (1,1,1).

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.