Utility functions for openCV.