fixed comparison to stop integer wrap around
fixed comparison to stop integer wrap around

opencv/opencv,opencv/opencv,apavlenko/opencv,opencv/opencv,opencv/opencv,opencv/opencv,opencv/opencv,apavlenko/opencv,apavlenko/opencv,apavlenko/opencv,opencv/opencv,opencv/opencv,opencv/opencv,apavlenko/opencv,apavlenko/opencv,opencv/opencv