fixed bug #3319

see http://code.opencv.org/issues/3319