fix canny crash in bug #2279
Merge pull request #325 from bitwangyaoyao:2.4_fixcanny