Bug 452878

Summary: Feature to search for images by color
Product: [Applications] digikam Reporter: Nicolas Brisset <nicolas.brisset>
Component: Searches-SimilarityAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED DUPLICATE    
Severity: wishlist CC: caulier.gilles
Priority: NOR    
Version: 7.5.0   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Nicolas Brisset 2022-04-22 19:48:27 UTC
STEPS TO REPRODUCE
1. I was asked to find some images by color in my 100k+ image collection, in order to organize some decoration based on the dominant color tone
2. I looked around all of digikam and I could not find a "search by color" tool :-(
3. I tried to approach the result by using the similarity search and drawing a sketch consisting of a plain color patch

OBSERVED RESULT
I get a very limited list of images (default: 10 if I remember correctly, which I can only increase to 50), which are mostly in the right tone - but not even quite uniform. I guess that's due to the algo used, as discussed in bug #207188: it isn't actually meant for what I'm trying to do...

EXPECTED RESULT
I would expect to find all (or at least a much higher number than 50) images from my collection that are "close enough" to the selected color

SOFTWARE/OS VERSIONS
Windows: 10
(since it's a feature request it actually applies to all OSes)

ADDITIONAL INFORMATION
I looked at some sites providing something like this feature, and found some hopefully relevant ideas:
- A blog at https://medium.com/@joshuawcomeau/search-by-colour-cb1ba49aa9aa describing some experiments in order to determine the "relevant" color, ie the one that actually sticks out and not necessarily the dominant background color. Not quite what I'm after, but it can also be an interesting alternative and probably some interesting ideas in terms of preprocessing
- An article at https://reasonabledeviations.com/2019/10/02/k-means-in-cpp/ describing k-means, an algorithm which I happen to have used recently (from python / scikit though) and which sounds very appropriate for the need at hand
- A website that provides more or less exactly what I'm looking for (albeit neither open-source nor applicable to my personal collection...) at https://labs.tineye.com/multicolr/#colors=f6d727;weights=100; and which has some hints on how it works on this page: https://services.tineye.com/MulticolorEngine - see in particular the "What are the major functions supported by the API?" section

What I imagine would be along the lines:
1. Add a tool to compute "color fingerprints", similar to the existing fingerprinting for similarity search. This tool would compute the n (fixed or varying, to be defined - but probably around 5 to 10 at most) dominant ucolors using k-means and store their relative frequency if possible. Some preprocessing may be applied (color paletization, downsizing, ...) if it helps for performance reasons
2. A "Color" tab could be added to similarity search along Duplicate / Image / Sketch, in which the user could select a few colors with their percentage (see https://labs.tineye.com/multicolr/#colors=f6d727;weights=100; for inspiration)
3. Some options may be added, like maximum tolerance or maximum number of hits to return. Why not also an option to use the first algo linked above, to focus more on the colors that stick out than the most frequent one(s)
4. Once the colors and options are set, a "simple" (euclidian or better: perceptual) distance search on the fingerprints is performed and the found images are listed as for the other similarity search tools
Comment 1 caulier.gilles 2022-04-25 06:26:48 UTC
Nicolas, i send a response to your private mail relevant of this report…

Gilles
Comment 2 caulier.gilles 2023-12-01 12:51:24 UTC

*** This bug has been marked as a duplicate of bug 207188 ***