Build an interactive CLI or Streamlit tool that allows users to upload an image, apply blurring or sharpening filters, and view/download the processed image.
- Ask user:
"What would you like to do with the image?"
Choose one of the following options:
-
1. Apply Gaussian Blur -
2. Apply Median Blur -
3. Apply Sharpening Filter -
4. View Original Image
-
Ask user to upload an image or provide file path (CLI).
-
Ask for:
-
Kernel size (x, y)β must be odd (e.g., (3,3), (9,9), (21,21)) -
Sigmaβ strength of blur (e.g., 0 to 5)
-
-
Apply Gaussian Blur using:
cv2.GaussianBlur(img, (kernel_x, kernel_y), sigma)
-
Display the blurred image.
-
Offer Download option.
π Note: Gaussian Blur smoothens the image by averaging pixel values around the center pixel.
-
Ask user to upload an image or provide file path (CLI).
-
Ask for:
Kernel sizeβ must be odd (e.g., 3, 5, 7)
-
Apply Median Blur using:
cv2.medianBlur(img, kernel_size)
-
Display the denoised (median-blurred) image.
-
Offer Download option.
π Note: Median Blur is great for removing salt-and-pepper noise by replacing pixel with the median of surrounding values.
-
Ask user to upload an image or provide file path (CLI).
-
Ask for:
ddepthβ depth of output image (use-1to retain original)
-
Define sharpening kernel:
kernel = np.array([[0, -1, 0], [-1, 5, -1], [0, -1, 0]]) sharpened_img = cv2.filter2D(src, ddepth, kernel)
-
Display the sharpened image.
-
Offer Download option.
π Note: Sharpening enhances edges and increases image contrast by boosting center pixel intensity.
- Simply show the uploaded image without any processing.