简体   繁体   English

是否有比O(N ^ 2)算法更好的方法来获取一组颜色并返回形成对比或不相似的颜色?

[英]Is there a better than O(N^2) Algorithm to take a set of colors and return colors that contrast or are dissimilar?

I am trying to come up with an algorithm that can take a set of colors X and return a new set of colors X' that consists of only contrasting colors from the original set X. In other words I want to filter out similar colors from the passed in color set. 我正在尝试提出一种算法,该算法可以采用一组颜色X并返回一组新的颜色X',该组颜色X'仅包含原始组X中的对比色。换句话说,我想从中过滤掉相似的颜色通过颜色设置。 If you would like to think in terms of color differencing, the problem can be thought of filtering out all colors that are <= some distance k from any color in the set. 如果要考虑颜色差异,可以考虑将所有颜色与集合中的任何颜色相距小于或等于k的所有颜色过滤掉。

Does anyone know of a way to do this in linear time or O(N). 有谁知道在线性时间或O(N)中执行此操作的方法。 I am ok with other time complexities as well as long as it is not O(N^2), every solution I come up with takes polynomial time. 只要不是O(N ^ 2),我对其他时间复杂度都可以,我想出的每个解决方案都需要多项式时间。 I tried reducing the problem to the famous "find all pairs of integers in an array that sum to K" but that reduction did not work. 我尝试将问题简化为著名的“在数组中求和为K的所有整数对”,但这种归零法不起作用。 I am using the deltaE metric to determine how far apart or dissimilar/contrasting two colors are. 我正在使用deltaE度量标准来确定两种颜色之间的距离或相异/对比度。

Use a cover tree to store colors under the ∆E metric. 使用覆盖树将颜色存储在∆E度量标准之下。 For each color, do an O(log n)-time proximity search in the cover tree and reject it if the nearest color is too close. 对于每种颜色,在覆盖树中进行O(log n)次接近搜索,如果最接近的颜色过于接近,则拒绝它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 比 O(n) 更好的范围交集算法? - A range intersection algorithm better than O(n)? 在算法时间复杂度上总是 O(1) 优于 O(n)? - Always O(1) is better than O(n) in algorithm time complexity? 是否有比O(N)更好的算法来找到主要由连续块组成的比特阵列中的第一个比特集? - Is there any algorithm better than O(N) to find the first bit set in a bitarray that consists mostly of continous blocks? 将levenshtein算法的damerau版本优化为优于O(n * m) - Optimizing the damerau version of the levenshtein algorithm to better than O(n*m) 找到相距最远点的算法——比 O(n^2) 更好? - Algorithm to find points that are furthest apart — better than O(n^2)? Levenshtein距离算法优于O(n * m)? - Levenshtein Distance Algorithm better than O(n*m)? 为调色板生成一组颜色的算法? - The algorithm to generate a set of colors for palette? 为什么这个o(n)三向集合不相交算法比o(n ^ 3)版本慢? - why is this o(n) three-way set disjointness algorithm slower than then o(n^3) version? 是否有一种算法可以找到总和小于给定 K 的子列表的数量? 优于 O(N^2) - Is there an algorithm for finding amount of sublists whose sum is smaller than given K? Better than O(N^2) O(N)算法比O(N logN)算法慢 - O(N) algorithm slower than O(N logN) algorithm
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM