Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[ENH]: rgb_to_hsv/hsv_to_rgb could check that the inputs are of floating point dtype #22651

Open
@anntzer

Description

@anntzer

Problem

If one passes 8-bit RGB values to rgb_to_hsv, the results are nonsensical. rgb_to_hsv indeed explicitly states that inputs should be 0-1 floats, but it is not too difficult to accidentally pass 8-bit values instead (e.g., plt.imread() is inconsistent as to whether it returns one or the other).

Proposed solution

rgb_to_hsv could include some check for that.

  • Checking that all values are exactly in [0, 1] may not actually be a good idea, as you could sometimes have values just a slop below 0 or above 1 due to earlier FP errors.
  • I would instead suggest checking that the input is of floating point dtype; technically onecould be passing a 0-1 image with integer dtype (where all the values are 0 or 1) but this seems rare and confusion-prone anyways.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp