Skip to content

Latest commit

Β 

History

History
128 lines (64 loc) Β· 2.51 KB

File metadata and controls

128 lines (64 loc) Β· 2.51 KB

πŸ–ΌοΈ Image Blurring and Filtering App

🎯 Objective

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.


πŸ”§ Instructions

  1. 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


🌫️ If Option 1 Selected: Apply Gaussian Blur

User Interface:

  • 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)

Actions:

  • 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.


🎯 If Option 2 Selected: Apply Median Blur

User Interface:

  • Ask user to upload an image or provide file path (CLI).

  • Ask for:

    • Kernel size β€” must be odd (e.g., 3, 5, 7)

Actions:

  • 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.


🎯 If Option 3 Selected: Apply Sharpening Filter

User Interface:

  • Ask user to upload an image or provide file path (CLI).

  • Ask for:

    • ddepth β€” depth of output image (use -1 to retain original)

Actions:

  • 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.


πŸ–ΌοΈ If Option 4 Selected: View Original Image

  • Simply show the uploaded image without any processing.

πŸ“„ Solution & 🌐 App