Skip to content

Repository files navigation

Applied Computer Vision and Machine Learning Projects

A collection of collaborative academic projects exploring classical image processing, motion analysis, physical measurement from video, and supervised machine learning with Python.

The repository contains three applied studies:

  1. Eye-region segmentation from a nystagmus video
  2. Liquid viscosity estimation through marble tracking
  3. Geometric shape classification with MLP and SVM models

These notebooks were developed as Team 512 coursework in 2023. They are educational prototypes rather than medical, laboratory, or production systems.

Repository Contents

Notebook Project Description
ProyectoPrimero.ipynb Nystagmus video methodology Tests color channels, histograms, thresholding, Gaussian smoothing, Sobel gradients, and Laplacian filtering to define an eye-region segmentation workflow.
Resultados.ipynb Nystagmus video results Automates frame extraction, eye-region cropping, thresholding, and Sobel-based processing across the complete video.
Viscosidad.ipynb Computer-vision viscosity estimation Detects and tracks a falling marble, maps pixel coordinates to physical measurements, estimates velocity and density, and calculates liquid viscosity.
Modelos.ipynb Shape classification Trains and compares a multilayer perceptron and an RBF support vector machine using eccentricity and extent to classify circles, rectangles, and triangles.

Project 1: Eye-Region Segmentation

The first project develops a classical computer-vision pipeline for processing frames from a nystagmus video. The methodology evaluates multiple preprocessing alternatives before selecting a repeatable workflow.

Workflow

  • Extract frames from the source video.
  • Crop the right and left eye regions.
  • Compare RGB channel information.
  • Inspect grayscale histograms.
  • Apply fixed-threshold binarization.
  • Compare Gaussian blur, Sobel gradients, and Laplacian edge enhancement.
  • Select thresholding followed by Sobel filtering as the final segmentation approach.
  • Apply the procedure to the complete video in Resultados.ipynb.

The project focuses on image segmentation and visualization. It does not diagnose nystagmus or provide clinical conclusions.

Project 2: Liquid Viscosity Estimation

This notebook uses computer vision to follow a marble falling through dish soap and connect its observed motion with a physical viscosity calculation.

Workflow

  • Extract video frames with OpenCV.
  • Convert frames to grayscale and reduce noise with Gaussian filtering.
  • Segment the marble through thresholding.
  • Refine the mask with morphological closing and dilation.
  • Detect contours and calculate centroids.
  • Map image coordinates to time and distance.
  • Estimate the marble's velocity, radius, volume, and density.
  • Calculate viscosity using a falling-sphere formulation.

Saved Results

Measurement Result
Estimated average velocity 2.67 cm/s
Estimated marble diameter 2.02 cm
Estimated marble density 2.33 g/cm³
Initial viscosity estimate 105.13 P (10,513.12 cP)
Corrected viscosity estimate 70.96 P (7,096.14 cP)

The notebook reports substantial experimental uncertainty because the environment was not controlled and the measurements were derived from external video and digitized coordinates. Accordingly, the results should be interpreted as an educational demonstration rather than a laboratory measurement.

Project 3: Shape Classification with MLP and SVM

The final notebook compares two supervised classifiers for identifying geometric figures from region properties.

Features and Models

  • Features: eccentricity and extent
  • Classes: circles, rectangles, and triangles
  • Preprocessing: label encoding, train-test split, and standard scaling
  • Models: multilayer perceptron and RBF support vector machine
  • Evaluation: multiclass ROC curves and confusion matrices
  • Image inference: largest-region extraction with scikit-image

In the saved notebook run, both models correctly classified all 31 test observations. The notebook also demonstrates predictions from numerical feature vectors and individual figure images. Because the dataset is small and visually separable, this result should not be treated as evidence of production-level generalization.

Technologies

  • Python
  • Jupyter Notebook
  • OpenCV
  • NumPy
  • pandas
  • Matplotlib
  • Pillow
  • scikit-learn
  • scikit-image
  • Seaborn
  • SciPy

Installation

Create and activate a virtual environment, then install the required packages:

python -m venv .venv

Windows

.venv\Scripts\activate

macOS or Linux

source .venv/bin/activate
pip install jupyter numpy pandas matplotlib opencv-python pillow scikit-learn scikit-image seaborn scipy
jupyter lab

Required Input Assets

The notebooks use relative paths and require companion files that are not embedded in the notebook documents.

Nystagmus project

video/nistagmus.mp4

The notebooks also create or read frame and output directories such as cuadros, img, img_izquierdo, and img_todo.

Viscosity project

videos/dish_soap_noise.mp4
cuadros/dish_soap/
Dataset.csv
Extracción.jpg

Shape-classification project

Combinado.csv
Círculo.png
Rectángulo.jpg
Triángulo.png

Adjust the paths when organizing the repository differently.

Suggested Repository Structure

applied-computer-vision-ml/
├── notebooks/
│   ├── ProyectoPrimero.ipynb
│   ├── Resultados.ipynb
│   ├── Viscosidad.ipynb
│   └── Modelos.ipynb
├── data/
├── images/
├── videos/
├── outputs/
├── requirements.txt
└── README.md

Skills Demonstrated

  • Video-frame extraction and preprocessing
  • Image segmentation and edge detection
  • Contour, centroid, and region-property analysis
  • Mapping pixel measurements to physical variables
  • Experimental error assessment
  • Feature engineering and data scaling
  • Multiclass classification with MLP and SVM
  • ROC-curve and confusion-matrix evaluation
  • Reusable Python functions and workflow automation

Academic Use

This repository documents academic exercises in image processing and machine learning. The nystagmus project is not a medical diagnostic tool, while the viscosity estimates are not substitutes for controlled laboratory measurements.

About

Python projects covering eye-region segmentation, viscosity estimation from video, and geometric shape classification with MLP and SVM.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages