Fix canny segment fault (Bug #3978)

Avoid too large size cause std::vector::resize() failed.
Please refer to http://code.opencv.org/issues/3978.

check_regression=*anny*

first, the scale factor can still be not enough, secondly, it's too aggressive in most cases. Can you replace it with
<pre>
maxsize = std::max(maxsize * 3/2, sz + src.cols);
</pre>

?