function for computing threshold to get x num of superpixels..
added code for not recomputing..