bug fix for issue 3470

http://code.opencv.org/issues/3470