add a option to build library as shared.
simplify API so that OpenCV does not needed to be included in the header.