Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hueHistogram and histogram are scalled according to min and max non zero hue value #688

Open
GintasTr opened this issue Jun 3, 2016 · 0 comments

Comments

@GintasTr
Copy link

GintasTr commented Jun 3, 2016

If img.hueHistogram, or a basic img.histogram are used with an image which does not cover whole range of 255 hue values, the output histogram is scaled so that minimum non 0 hue value represents histogram [0] and maxmimum non 0 hue value represents histogram [number of bins].

This happens when images are almost uniform in terms of colour, or they are very small, so the range of colours does not cover whole range of hue values. Then hue histogram is shown incorrectly. I believe this is an unintentional feature and might produce incorrect results when used in certain specific conditions.

I believe this happens because, when np.histogram is called, no range argument is passed, thus, quoting the np.histogram description, "range is simply "(a.min(), a.max())". Values outside the range are ignored."
Calling the np.historam manually with the addition of argument range=(0.0, 255.0) seems to fix the issue.
Attached are histograms of roughly orange (average hue of approximately 11) 20 by 20 pixels image with only single hue peak at ~11.

issue_report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant