MCPcopy Create free account
hub / github.com/OpenShot/libopenshot / GetDistance

Method GetDistance

src/Color.cpp:69–76  ·  view source on GitHub ↗

Get the distance between 2 RGB pairs (alpha is ignored)

Source from the content-addressed store, hash-verified

67
68// Get the distance between 2 RGB pairs (alpha is ignored)
69long Color::GetDistance(long R1, long G1, long B1, long R2, long G2, long B2)
70{
71 long rmean = ( R1 + R2 ) / 2;
72 long r = R1 - R2;
73 long g = G1 - G2;
74 long b = B1 - B2;
75 return sqrt((((512+rmean)*r*r)>>8) + 4*g*g + (((767-rmean)*b*b)>>8));
76}
77
78// Generate JSON string of this object
79std::string Color::Json() const {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected