Live data from Hacker News

3D scatterplot of an image

alexander.engineering

11–20 of 78 posts

Re: 3D scatterplot of an image

#11

This is cool, but I wonder why most of the demo images - and a lot of the images I uploaded - seem to have their colors aligned in a single plane.

Partly it is because real objects are often made out of a single colour. The camera sees different parts of the object under different lighting conditions. That mainly only changes the brightness. Specular highlights also desaturate the base colour, but nothing changes the hue. So all the pixels for that object tend to be aligned on a plane in the colour space plot.

In the example images, the sand in the sand+sky picture is the only thing this is really true for.

Re: 3D scatterplot of an image

#12
post #2

Would it be possible to make a human recognizable 3D-object in the colorspace that also is a pretty picture in 2D?

The answer is quite obvious. You could start off with a grayscale 2D image on one side, and a pretty dotted 3D object on the other side. You'd then read the coordinates of the 3D object in a specific color space to obtain color values which you can pretty randomly (or even judiciously) apply to the grayscale image.

Now I would pose another question: would it be possible to make a human-recognizable 3D-object in all the four color spaces that is also a pretty picture in 2D?

Re: 3D scatterplot of an image

#13
post #2

Would it be possible to make a human recognizable 3D-object in the colorspace that also is a pretty picture in 2D?

Yeah, the points in the 3D colourspace have no mapping to a 2D location on an image, you could create one that gives a pretty image if you wanted.

Re: 3D scatterplot of an image

#14

This is cool, but I wonder why most of the demo images - and a lot of the images I uploaded - seem to have their colors aligned in a single plane.

Hmm, I guess someone would have thought of that, but this could probably be used for compressing images by reorienting the color axes so that one of them is perpendicular to this color plane, and then sending less information about that coordinate.

Yeah, you can use principle component analysis to figure out the transform to make the colour space "optimal" for compression of a specific image. I tried that once:

https://bainbridgecode.wordpress.com/2012/04/24/beating-png-...

and

https://bainbridgecode.wordpress.com/2012/05/07/beating-png-...

There are plots at the end of part 3 showing the image channels separately for YCrCb and my custom PCA derived space. They clearly show that there's a lot less duplication of data between channels with the latter. And that in turn is obviously good for compression.

Re: 3D scatterplot of an image

#15

This is cool, but I wonder why most of the demo images - and a lot of the images I uploaded - seem to have their colors aligned in a single plane.

The original values are 3 dimensional and therefore best represented in a cube. If HSV is used, the hue is isolated to one dimension, which would represent the circumfrance of the color wheel you’re thinking of. The colors around the circular surface of your cylinder could be calculated from that, but you would be left with only one more display dimension and 2 more values: value (brightness/darkness) and saturation. You could only display one of them in the single empty dimension left in the cylinder.

Another way to explain why a cylinder is only good for representing two dimensions is simply that a circle asserts that length(x) == width(y) leaving only 2 values represented by a cylinder: (x,y) and z.

Re: 3D scatterplot of an image

#16
This is really cool! I'm a painter and have spent a long time doing gamut analysis of paintings.

Thank you for including both HSV and HSL. Not enough people appear to understand/care about the difference between the two, and for painters the distinction is everything.

Re: 3D scatterplot of an image

#17
I'm not sure if they are mapping every single pixel or using some average pixels, but it's pretty fast.

Here is a shameless plug for one of my color extracting library: https://github.com/jathu/UIImageColors/

It currently takes around ~0.3s on average to extract the colors. However, with my new PR (https://github.com/jathu/UIImageColors/pull/54), it takes around ~0.14s on average. IMO this is still slow, I would like to bring it below 0.1s.

I tried to optimize this with k-means to reduce total number of colors, but the result was slower and worse color choices. If anyone has methods to improve the performance, please make a PR.

Re: 3D scatterplot of an image

#18
post #17

I'm not sure if they are mapping every single pixel or using some average pixels, but it's pretty fast. Here is a shameless plug for one of my color extracting library: https://github.com/jathu/UIImageColors/ It currently takes around ~0.3s on average to extract the colors. However, with my new PR ( https://github.com/jathu/UIImageColors/pull/54 ), it takes around ~0.14s on average. IMO this is still slow, I would li…

What takes so long in your approach? I would think extracting simple statistical values from an image is a very easy to vectorise and parallelise task.

Re: 3D scatterplot of an image

#20

This is really cool! I'm a painter and have spent a long time doing gamut analysis of paintings. Thank you for including both HSV and HSL. Not enough people appear to understand/care about the difference between the two, and for painters the distinction is everything .

Why is the distinction important for painters?
Post reply on HN