'Create the shape context objects.
dsz - The size of descriptor as a dszxdsz histogram
completeContour - All of the edge points as a long list
r_bound - Bounds on the log part of the shape context descriptor'

def _generateSC(self, completeContour, dsz=6, r_bound=[0.1, 2.1]):

    data = []
    for pt in completeContour:
        temp = []
        for b in completeContour:
            r = np.sqrt((((b[0] - pt[0]) ** 2) + ((b[1] - pt[1]) ** 2)))
            if (r == 0.0):
                continue
            r = np.log10(r)
            theta = np.arctan2((b[0] - pt[0]), (b[1] - pt[1]))
            if (np.isfinite(r) and np.isfinite(theta)):
                temp.append((r, theta))
        data.append(temp)
    descriptors = []
    for d in data:
        test = np.array(d)
        (hist, a, b) = np.histogram2d(test[:, 0], test[:, 1], dsz, [r_bound, [((np.pi * (-1)) / 2), (np.pi / 2)]], normed=True)
        hist = hist.reshape(1, (dsz ** 2))
        if np.all(np.isfinite(hist[0])):
            descriptors.append(hist[0])
    self._scdescriptors = descriptors
    return descriptors
