2011-11-17 274 views

回答

1

OpenCV可能會做。

+1

['cvCvtColor'功能](http://www.cs.iit.edu/~agam/cs512/lect-notes/opencv-intro/opencv-intro。 html#SECTION00054000000000000000) – jlstrecker

+1

它沒有。 OpenCV會丟失Delte E函數,並且它的cvtColor()函數在圖像上操作,如果您只想轉換一個顏色值,則該操作不方便。 – user1050747

+0

難道你不能用Lab顏色空間很容易地計算出它嗎?另外,你的意思是「只轉換顏色值」? – stnr

2

我已經使用Javascript編寫了代碼。翻譯爲C非常容易!

請參閱deltaE2000(),它採用LCHab中的顏色,可能還有轉換RGB→線性RGB→XYZ→實驗→LCHab的功能。 CodeUI demo

0

嘗試http://github.com/dmilos/color

代碼示例:

typedef ::color::rgb<double> color_t; // or lab or hsv or any other available model 

color_t a = ::color::constant::orange_t{};  
color_t b = ::color::constant::chocolate_t{}; 

std::cout << ::color::operation::distance<::color::constant::distance::CIE94_textile_entity>(a, b) << std::endl; 
std::cout << ::color::operation::distance<::color::constant::distance::CIEDE2000_entity>(a, b) << std::endl; 

其他例子與其他algorithams: https://github.com/dmilos/color/tree/master/example/less-than-1k/operation/distance

顏色模型是無關緊要的。它會自動內部轉換。

所有公式在記載:http://en.wikipedia.org/wiki/Color_difference