'**SUMMARY**
Returns an image representing the distance of each pixel from the given hue
of a specific color.  The hue is "wrapped" at 180, so we have to take the shorter
of the distances between them -- this gives a hue distance of max 90, which we\'ll
scale into a 0-255 grayscale image.
The minsaturation and minvalue are optional parameters to weed out very weak hue
signals in the picture, they will be pushed to max distance [255]
**PARAMETERS**
* *color* - Color object or Color Tuple.
* *minsaturation*  - the minimum saturation value for color (from 0 to 255).
* *minvalue*  - the minimum hue value for the color (from 0 to 255).
**RETURNS**
A simpleCV image.
**EXAMPLE**
>>> img = Image("logo")
>>> img2 = img.hueDistance(color=Color.BLACK)
>>> img2.show()
**SEE ALSO**
:py:meth:`binarize`
:py:meth:`hueDistance`
:py:meth:`morphOpen`
:py:meth:`morphClose`
:py:meth:`morphGradient`
:py:meth:`findBlobsFromMask`'

def hueDistance(self, color=Color.BLACK, minsaturation=20, minvalue=20, maxvalue=255):

    if isinstance(color, (float, int, long, complex)):
        color_hue = color
    else:
        color_hue = Color.hsv(color)[0]
    vsh_matrix = self.toHSV().getNumpy().reshape((-1), 3)
    hue_channel = np.cast['int'](vsh_matrix[:, 2])
    if (color_hue < 90):
        hue_loop = 180
    else:
        hue_loop = (-180)
    distances = np.minimum(np.abs((hue_channel - color_hue)), np.abs((hue_channel - (color_hue + hue_loop))))
    distances = np.where(np.logical_and((vsh_matrix[:, 0] > minvalue), (vsh_matrix[:, 1] > minsaturation)), (distances * (255.0 / 90.0)), 255.0)
    return Image(distances.reshape(self.width, self.height))
