Reduce veriables scope, move declaration to first use
Reduce veriables scope, move declaration to first use

opencv/opencv,opencv/opencv,opencv/opencv,opencv/opencv,opencv/opencv,opencv/opencv,opencv/opencv,opencv/opencv,opencv/opencv,opencv/opencv