converted to opencv 2.4.9