-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
712421a
commit 4694371
Showing
1 changed file
with
16 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import cv2 | ||
|
||
def process_and_show_image(image_path): | ||
image = cv2.imread(image_path) | ||
|
||
if image is None: | ||
print("Error: Unable to read the image.") | ||
return | ||
|
||
grayscale_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) | ||
|
||
cv2.imshow("Original Image", image) | ||
cv2.imshow("Grayscale Image", grayscale_image) | ||
|
||
cv2.waitKey(0) | ||
cv2.destroyAllWindows() |