The python script uses OpenCV (all the cv2.xxxx). With a similar syntax, all those methods are available in OpenCvforB4A.
I'm not sure if that script is tuned for a specific sheet, but it seems a good starting point.
PM me if you want the lib (it's free

)