Hacker News new | ask | show | jobs
by jamessb 3997 days ago
This is very nice.

I particularly like the automatic mode. However, the deafult 'distance' threshold of 120 seems to be too large: selecting the yellow foreground color picks points on both the yellow and red lines; selecting the green foreground color picks points on both the green curve and the axes.

A solution for the test image is to just reduce the threshold to 50.

The best threshold may depend on both the target color and the specific image being processed, but could potentially be automatically chosen: imagine constructing a greyscale image by replacing each pixel's color with its distance from the target color, and then picking a threshold for converting this grayscale image to a binary image (e.g. using Otsu's method [0]).

The export to plot.ly feature is also great - you can really quickly extract data from one graph and re-plot it in a different/clearer way.

[0]: https://en.wikipedia.org/wiki/Otsu%27s_method

1 comments

Hey, I am the developer of this app. Thanks for the feedback on the color distance. Also, I wasn't aware of the Otsu method, but have thought of doing something very similar - I will give it a shot for sure. I have added an enhancement item in the issue tracker.
On further thought this probably won't work very well: the histogram of colour distances will be multimodal, with one peak for each color in the image (and with the peak corresponding to the white background being far taller than the others). The Otsu method assumes there is just a foreground and background that need to be separated.

A clustering method like k-means might work, but I've had a quick play in Matlab and the results weren't great.

Thanks for trying it out. I am also working on a grid removal algorithm which will run into similar issues and so it's good to get some ideas. The naive color distance approach might not be the best for that scenario.