Whenever you're ready, walk me through how you'd approach this.
Write a function to detect edges in an image using the Sobel operator.
Explain how the horizontal and vertical Sobel kernels are applied, how gradient magnitude is computed, and how the result is converted into an edge map. State assumptions about grayscale conversion, image boundaries, output representation, and threshold selection. The expected discussion should focus on the algorithm and its time and space complexity rather than a framework-specific implementation.