Skip to content

nguyenpd-vincent/VisionSeg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 VisionSeg: Enhanced Image Segmentation Framework

📌 Overview

VisionSeg is a modular computer vision framework for classical image segmentation, designed with software engineering principles.

Unlike simple scripts, this project is built as a scalable system with:

  • Config-driven pipelines
  • Modular architecture
  • Extendable components

It focuses on separating foreground objects from background using traditional computer vision techniques.


🎯 Key Features

🔹 Segmentation Methods

  • Fixed Thresholding
  • Otsu Thresholding
  • Adaptive Thresholding

🔹 Morphological Processing

  • Erosion
  • Dilation
  • Opening (noise removal)
  • Closing (hole filling)

🔹 Object Analysis

  • Connected Components
  • Object Counting
  • Area Filtering

🔹 Visualization

  • Bounding Boxes
  • Object Highlighting
  • Result Export

🔹 System Features

  • Config-driven pipeline (config.yaml)
  • Modular code structure
  • Easy extensibility

🧠 Concepts Covered

  • Image Segmentation
  • Binary Thresholding
  • Morphological Transformations
  • Noise Reduction
  • Connected Component Analysis
  • Pipeline Design in Computer Vision

🏗️ Flow of the Project & Technologies

Technologies Used:

  • Python: Core programming language.
  • OpenCV (cv2): Image processing, thresholding, morphology, and component analysis.
  • NumPy: Matrix operations and statistical calculations (e.g., median area).
  • PyYAML: Configuration management.

Pipeline Flow:

1. Input Image
     ↓
2. Preprocessing (Grayscale, CLAHE Contrast Enhancement, Gaussian Blur)
     ↓
3. Segmentation (Otsu / Adaptive / Fixed Thresholding)
     ↓
4. Morphology (Opening, Closing, Dilating, Eroding for Noise Removal)
     ↓
5. Component Analysis (Connected Components, Area Filtering, Circularity)
     ↓
6. Visualization & Output (Bounding Boxes, Highlighted Objects)

📁 Project Structure

visionseg/
│
├── main.py
├── config.yaml
├── requirements.txt
├── README.md
│
├── src/
│   ├── preprocessing/
│   │   └── grayscale.py
│   ├── segmentation/
│   │   └── threshold.py
│   ├── morphology/
│   │   └── operations.py
│   ├── analysis/
│   │   └── components.py
│   ├── visualization/
│   │   └── draw.py
│   └── pipeline/
│       └── pipeline.py
│
├── resources/
│   └── coins.jpg
│
└── outputs/
    └── result.png

⚙️ Installation

Requirements

  • Python 3.x
  • OpenCV
  • NumPy
  • PyYAML

Environment Setup & Installation

  1. Create a Virtual Environment:

    python -m venv venv
  2. Activate the Environment:

    • Mac / Linux:
      source venv/bin/activate
    • Windows:
      venv\Scripts\activate
  3. Install Dependencies:

    pip install -r requirements.txt

▶️ Usage

1. Clone repository

git clone https://github.com/nguyenpd-vincent/VisionSeg.git
cd VisionSeg

2. Configure pipeline

Edit config.yaml:

preprocessing:
  grayscale: true

segmentation:
  method: otsu   # threshold | otsu | adaptive
  threshold:
    value: 120

  adaptive:
    block_size: 11
    C: 2

morphology:
  operation: close     # open | close | erode | dilate | none

  kernel:
    size: 5 # 3, 5, 7
    shape: ellipse     # square | ellipse | cross

analysis:
  min_area: 500
  max_area: 50000

3. Run

python main.py --image resources/coins.jpg

📊 Results

  • Accurate foreground-background separation
  • Noise reduction via morphology
  • Detection and counting of objects

🔬 Experiments

Can explore:

  • Different threshold values
  • Kernel sizes (3x3 → 5x5)
  • Morphological operations
  • Otsu vs Adaptive thresholding

🎯 Learning Outcomes

This project demonstrates:

  • Strong understanding of classical computer vision
  • Ability to design modular systems
  • Experience with configurable pipelines
  • Practical segmentation and object detection skills

About

VisionSeg is a modular image segmentation framework using classical computer vision techniques. It supports preprocessing, segmentation, morphology, and connected component analysis for efficient object detection and foreground–background separation, with a flexible and extensible design.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages