applied patch #2611 that also likely fixes #2505
applied patch #2611 that also likely fixes #2505

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