Live data from Hacker News

3D scatterplot of an image

alexander.engineering

21–30 of 78 posts

Re: 3D scatterplot of an image

#21
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…

With 24 bit color you can create an array with an element for each of the 16 million colors and just build the histogram. Running k-means on that is going to be less efficient than just making the histogram buckets larger, e.g. 2x2x2 = 8 colors per bucket, or whatever. So yeh you should be able to do that in a few milliseconds I would have thought. For more speed look at using SIMD instructions.

Re: 3D scatterplot of an image

#22
post #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.

[deleted]

Re: 3D scatterplot of an image

#24
In the late '90s I was asked to do image segmentation of multispectral data of brightfield microscope data. That is, given a picture of a bunch of cells, find all of the cells. There were two problems: image segmentation of sick cells is really hard (they're very blobby & fragmented), and the computer I had available took more than 20 minutes per image.

It was literally both cheaper and faster to have a grad student count the cells.

Let's be clear though: the researchers weren't interested in the cells; they were interested in having a pretty-darn-good count of cancerous cells vs. non-cancerous cells. Turns out, cancerous cells were a different color (brighter blue * brighter green) than healthy cells. So, instead, I just converted every image into RGB 3D space, counted all the pixels near 'dark green * dark blue', all the pixels near 'bright green * bright blue' then divided by the average area (in pixels) of each type of cell. The resulting counts were within 1% of the value the grad students could get, and the ratio was even more accurate.

We could get the cell count in a single linear, forward pass, as fast as the camera could take pictures.

Re: 3D scatterplot of an image

#25
This reminds me of a machine vision application for large-scale bakeries. When you bake bread, the color of the surface changes as the bread rises and completes the baking process.

In the application I remember, the average color of a loaf was tracked on an RBG plot as a function of time. The idea was that the baking process followed a trajectory in the RGB space that was dependent on the temperature of the oven and the elapsed time. This can be used as feedback for process control-- to signal when to pull out the bread or to change the temperature.

In a similar way the color of paintings change as they age. The individual points in the OP's plots could be parameterized in time and according to paint's chemistry. It might be possible, after some calibration studies, to accurately simulate aging. Or better, simulate the reversal of aging to show what an old aged painting looked like when it was new.

Re: 3D scatterplot of an image

#28
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…

I too have been playing with color quantization as an exercise so I won't like at your library as I've been trying to do it all on my own and don't want to see other approaches yet, but here he is not quantizing them so his is going to be faster. Also there really is a trade off in trying to reduce the number of pixels and then clustering versus just clustering on them all. How many times you loop and how much those loops costs isn't as cut and dry as I thought.

Re: 3D scatterplot of an image

#29
post #4

So what's the insight behind such visualizations? Can it be used to separate photographic pictures from paintings for example?

This kind of visualization is useful to understand why filming an actor in front of a green screen makes sense for special effects.

If you look at such an image, you will have two clusters of pixels, one for the green screen, and one for the actor. By selecting the appropriate cluster you now know which pixels you need to replace for compositing your actor in front of a CGI background.

Post reply on HN