X0 = centers[:,3]
Y0 = centers[:,4]
# print X,Y
plt.plot(X0,Y0,"rx")


#Test rectangle extraction
indexes = S.calcRectIndexes(imgSpace, centers[12], gridInterval)
rectangle = imgSpace[indexes]

X1 = rectangle[:,3]
Y1 = rectangle[:,4]
plt.plot(X1,Y1,"bx")
plt.plot(X0,Y0,"rx")

#Test distance calculation
distance = S.calcDistance(gridInterval, rectangle, centers[12])
print rectangle.shape
print distance.shape

#Test clustering
distances = S.calcAllDistances(imgSpace, centers, K, gridInterval)
print distances.shape
print distances[0:10,:]





# plt.show()