edit OpenCV implementation