added gradientTreshold as a parameter