'**SUMMARY**
This function takes in an image and two points, calculates the intensity
profile between the points, and returns the single point at which the profile
crosses an intensity
**PARAMETERS**
* *p1, p2* - the starting and ending points in tuple form e.g. (1,2)
* *threshold* pixel value of desired threshold crossing
* *departurethreshold* - noise reduction technique.  requires this many points to be above the threshold to trigger crossing
**RETURNS**
A a lumpy numpy array of the pixel values. Ususally this is in BGR format.
**EXAMPLE**
>>> img = Image("lenna")
>>> myColor = [0,0,0]
>>> sl = img.getHorzScanline(422)
>>> sll = sl.tolist()
>>> for p in sll:
>>>    if( p == myColor ):
>>>        # do something
**SEE ALSO**
:py:meth:`getHorzScanlineGray`
:py:meth:`getVertScanlineGray`
:py:meth:`getVertScanline`'

def getThresholdCrossing(self, pt1, pt2, threshold=128, darktolight=True, lighttodark=True, departurethreshold=1):

    linearr = self.getDiagonalScanlineGrey(pt1, pt2)
    ind = 0
    crossing = (-1)
    if (departurethreshold == 1):
        while (ind < (linearr.size - 1)):
            if darktolight:
                if ((linearr[ind] <= threshold) and (linearr[(ind + 1)] > threshold)):
                    crossing = ind
                    break
            if lighttodark:
                if ((linearr[ind] >= threshold) and (linearr[(ind + 1)] < threshold)):
                    crossing = ind
                    break
            ind = (ind + 1)
        if (crossing != (-1)):
            xind = (pt1[0] + int(round((((pt2[0] - pt1[0]) * crossing) / linearr.size))))
            yind = (pt1[1] + int(round((((pt2[1] - pt1[1]) * crossing) / linearr.size))))
            retVal = (xind, yind)
        else:
            retVal = ((-1), (-1))
    else:
        while (ind < (linearr.size - (departurethreshold + 1))):
            if darktolight:
                if ((linearr[ind] <= threshold) and (linearr[(ind + 1):((ind + 1) + departurethreshold)] > threshold).all()):
                    crossing = ind
                    break
            if lighttodark:
                if ((linearr[ind] >= threshold) and (linearr[(ind + 1):((ind + 1) + departurethreshold)] < threshold).all()):
                    crossing = ind
                    break
            ind = (ind + 1)
        if (crossing != (-1)):
            xind = (pt1[0] + int(round((((pt2[0] - pt1[0]) * crossing) / linearr.size))))
            yind = (pt1[1] + int(round((((pt2[1] - pt1[1]) * crossing) / linearr.size))))
            retVal = (xind, yind)
        else:
            retVal = ((-1), (-1))
    return retVal
