查看单个帖子
旧 2009-05-06, 07:13 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】odcmentitycolorlookupaci

odcmentitycolor::lookupaci
odcmentitycolor::lookupaci
hi,
is odcmentitycolor::lookupaci fast? i mean - when there is 255 colors in aci, how many comparisions (average) is done when calling lookupaci with random rgb colors?
regards,
michal sliwka

i think it is not very fast (255 comparisons).
do you know a better approach?
sincerely yours,
george udov
the expression:
oduint32 curdif = 30*difred*difred + 59*difgreen*difgreen + 11*difblue*difblue;
was calculated 256 times to find minimal color difference.
today i optimized it to skip the rest of comparisons if difference is zero. it will not produce significant effect for random rgb color (probability of exact matching is too low). but for colors in cad application it may improve performance because simple colors like black, white, red, green etc. are used more frequently than random rgb.
sergey slezkin
i'm sorry, i forgot about this thread (what do you think about mail notifications for forum users?)
i think that one of possible solutions is to use kd-tree. it's structure for k-dimensional data (in our case - 3 dimensional - rgb) and fast nearest point searching to given one.
regards,
michal sliwka
mail notifications are on by default. probably you have not specified your e-mail or turned notifications off. check you profile, please.
as i understand kd-tree can be used to find only exact math. for arbitrary rgb in general we need to find nearest color. and all 3 components with weights are used to calculate the "color difference" value...
sergey slezkin
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)