added workaround for segfault on calculating img hash
some convertion from old opencv to opencv_2.4.9