A simple binarize operation would be possible to implement on your own. Edge detection is somewhat more complicated. But there are image processing libraries out there that contain tested code. And they are most likely speed-optimized to some degree. Have a look at
OpenCV for C#[
^]
Or read the article series
by Christian Graus[
^] dedicated to image processing.