added trackbar for threshold ratio