Add simple native function for thresholding image