, , - : , , , , @David Robinson, : , NP.array(v1fColor.split(","), dtype=NP.uint8), strage, 1.0 .
, :
import numpy as np
import numpy.linalg as LA
def testFunction():
value1 = '2,3,0,80,125,15,5,0,0,0,0,0,0,0,0,0,0,0,0,0,2,4,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0'
value2 = '2,137,0,4,96,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0'
cx = lambda a, b : round(np.inner(a, b)/(LA.norm(a)*LA.norm(b)), 3)
v1fColor = np.array( value1.split(','), dtype=np.uint8 )
v2fColor = np.array( value2.split(','), dtype=np.uint8 )
print v1fColor
print v2fColor
cosineValue = cx(v1fColor, v2fColor)
print cosineValue
if __name__ == '__main__':
testFunction()
, :

David:
v1fColor = np.array(map(int,value1.split(',')))
v2fColor = np.array(map(int,value2.split(',')))
, . 1.0, int casting, , :

, , , 1.0, python, - , . script, , , , . python, , , . @David Robinson, @mgilson.