Refactoring

> Originally at https://github.com/kevin-brown/mousetrap/pull/1

This is the pull request that will be used for code review, tracking progress, and eventually generating the patch set for this refactoring.
`cv` is not available in OpenCV 3 (it is technically the old `cv` library).  Sadly these parameters are no longer defined as "constants", so we may need to redefine them for compatibility purposes.