Put selectFrameSimple in a function. Fixed cv::minMaxIdx bug