Is it possible to auto detect edge after image capture?

Is it possible to auto detect edge of document after image capture?

Would you like to explain with example.

Taifun