The following solution is a C# implementation of Adrian Rosebrock How to Build a Kick-Ass Mobile Document Scanner in Just 5 Minutes (9-1-2014).
The original post was written to use Python 2.7 and OpenCV 2.4.X. These examples use OpenCV 3.x via EmguCV and OpenCVSharp.