This Python script demonstrates the implementation of the Sobel edge detection algorithm on an input image. The Sobel operator is used to compute the gradient of the image, highlighting edges and transitions in intensity.
-
Requirements:
- Python 3.x
- Required libraries:
matplotlib
,numpy
,opencv-python
-
Installation:
- Ensure you have the required libraries installed using
pip
:pip install matplotlib numpy opencv-python
- Ensure you have the required libraries installed using
-
Running the Code:
- Clone this repository or download the Python script.
- Replace the image path in the
mpimg.imread()
line with the path to your desired input image. - Execute the script, and it will display the original image and the edge-detected image using the Sobel operator.
Here's an example of the original image and the corresponding edge-detected image:
This code is a simple implementation of the Sobel edge detection algorithm .