Skip to content

Image filtering and segmentation experiments in Python using OpenCV and NumPy, completed during my study abroad at Hong Kong Baptist University (HKBU).

Notifications You must be signed in to change notification settings

Luka-Babetzki/filtering-and-segmentation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Filtering-and-Segmentation

A simple Python project for experimenting with classic image filtering and segmentation techniques using OpenCV and NumPy.

Features

  • Applies low-pass (smoothing) and median filters to images
  • Performs edge detection using the Canny algorithm
  • Segments images using:
    • K-means clustering
    • Region growing
    • Global and adaptive thresholding

Requirements

  • Python 3.x
  • OpenCV (opencv-python)
  • NumPy

Usage

  1. Install dependencies:

    pip install opencv-python numpy
  2. Set your image path:

    Each script contains a placeholder line such as:

    img = cv2.imread('c:/path/to/image.png')  # <-- Placeholder path

    Update this path to point to your own image file.

  3. Run a script:

    For example, to run the k-means segmentation:

    python Segmentation/k-means.py

    Or to apply a median filter:

    python Filtering/medium-filter.py

    Each script will display the processed image in a window.

Scripts Overview

  • Filtering/

    • low-pass-filter.py: Applies a 5x5 averaging filter
    • medium-filter.py: Applies a 5x5 median filter
    • edge-detection.py: Detects edges using Canny
  • Segmentation/

    • k-means.py: Segments image colours using k-means clustering
    • region-growth.py: Segments regions based on intensity similarity
    • thresholding.py: Performs global and adaptive thresholding

Notes

  • Ensure you update the image path in each script before running.
  • All scripts open a window to display results; press any key to close.

About

Image filtering and segmentation experiments in Python using OpenCV and NumPy, completed during my study abroad at Hong Kong Baptist University (HKBU).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages