OpenCV is a huge library but I think you can compile it with only the needed functions. What do you think about building it as a static lib? I am working on a similar problem with OpenCV (but not for edge detection) and I'm curious about your approach.