Understanding the format of a vips_hist_find_ndim image #3537
Replies: 2 comments
-
Hey @kipcole9, It's just a 5 x 5 x 5 matrix, so a cube. Maybe imagine a Rubik's cube, except 5x5x5, not 3x3x3? If you hold the cube with one face towards you, you'll see a 5x5 grid. That's the (x, y) you pass to Each cube holds a number, and that's the number of pixels which fell into that RGB bucket. So (for example) the first number from the five at (0, 0) is the number of pixels where R, G and B are all between 0 and 51, so blackish pixels. |
Beta Was this translation helpful? Give feedback.
-
@jcupitt so simple when you say it and makes total sense. Thank you as always. |
Beta Was this translation helpful? Give feedback.
-
For the life of me I can't get my head around the return from
vips_hist_find_ndim
. My intent is for a simply proxy for getting the "common colours" of an image.If I have an image,
image
and I callvips_hist_find_ndim(image, bins: 5)
I can see the shape of the return is an image that is 5 wide, 5 high with 5 bands.If I
get_pixel(histogram, 0, 0)
I receive back[a, b, c, d, e]
.I'd greatly appreciate an understanding of how to interpret the three dimensions. I know this should be simple (and I've worked with histograms in photography for decades) - but for some reason my brain is failing on this.
Thanks much for any guidance.
Beta Was this translation helpful? Give feedback.
All reactions