Skip to content

Repository files navigation

Curso de Computer Vision y Machine Learning

Overview

This repository is a Spanish-language learning project for computer vision and introductory machine learning with Python. It contains standalone scripts, sample images, videos, and presentation files used to demonstrate image processing, object segmentation, feature extraction, classification, face detection, license plate recognition, and simple neural-network workflows.

The project is best understood as a course/demo repository rather than a packaged application. Most scripts are intended to be run directly from their own folders because they load local image or video files using relative paths.

Key Features

  • Basic image loading, grayscale conversion, thresholding, masking, connected components, contour analysis, and histogram visualization.
  • Image filtering and edge detection examples using convolution kernels, Gaussian blur, Sobel, Laplacian, and Canny.
  • Object segmentation and measurement examples using convex hulls, bounding boxes, rotated rectangles, and homography.
  • Background modeling examples for detecting moving objects in traffic videos.
  • Banana/apple classification using handcrafted color and shape features with a linear classifier.
  • License plate detection and character recognition using OpenCV preprocessing, HOG features, KNN, SVM, and a TensorFlow/Keras neural network example.
  • Webcam face and eye detection using OpenCV Haar cascade XML files.
  • Automatic multiple-choice answer sheet grading from a scanned/photographed form.
  • A CNN example for benign/malignant skin lesion classification that expects an external data/ directory.

Technical Approach

The repository is organized as a set of teaching examples rather than a single pipeline. The scripts use OpenCV and NumPy heavily for image manipulation, with SciPy for morphology/fill operations and scikit-learn/TensorFlow for classifier examples.

Several examples follow a common workflow:

  1. Load an image or video frame from a local file or camera.
  2. Convert to grayscale or another color space.
  3. Segment foreground regions using thresholding, Canny edges, connected components, or contour detection.
  4. Extract measurements or descriptors such as area, color averages, aspect ratio, bounding boxes, convex hulls, or HOG features.
  5. Visualize the result with cv2.imshow, Matplotlib, or console output.

The license plate examples combine plate localization, perspective correction, character segmentation, HOG descriptors, and character classifiers. The fruit classifier extracts simple handcrafted features and fits a linear decision boundary. The cancer example defines and trains a small convolutional neural network, but the expected image dataset is not included in the repository.

Tech Stack

  • Python
  • OpenCV (opencv-contrib-python==3.4.2.17)
  • NumPy
  • SciPy
  • scikit-learn
  • scikit-image
  • TensorFlow/Keras (tensorflow==2.3.1)
  • Matplotlib

Dependencies are listed in requerimientos.txt.

Techniques Used

  • Classical computer vision
  • Image thresholding and segmentation
  • Contour detection and connected components
  • Convex hulls, bounding boxes, and perspective transforms
  • Filtering, convolution, and edge detection
  • Background subtraction/modeling for video
  • HOG feature extraction
  • KNN and SVM classification
  • Simple linear classification from handcrafted features
  • Convolutional neural networks with Keras
  • Haar cascade face and eye detection

Repository Structure

.
├── Procesamiento de Imagenes/
│   ├── IntrodImagenes.py
│   ├── filtrado.py
│   ├── convolucion.py
│   ├── deteccionBordes.py
│   ├── SegBordes.py
│   ├── homografia.py
│   ├── modeloFondo.py
│   ├── video.py
│   └── sample images and traffic videos
├── Proyecto de VIsion Artificial (Calificador Automatico)/
│   ├── califAutom.py
│   └── answer-sheet sample images
├── clasificacion (banano - manzana) /
│   ├── clasifBM.py
│   └── banana/apple training and test images
├── reconocimientoPlacas/
│   ├── deteccionPlaca.py
│   ├── detectarCaracteres.py
│   ├── reconocimientoCaracteres.py
│   ├── placaVideo.py
│   ├── ANN.py
│   └── plate character images and video samples
├── reconocimientoRostro/
│   ├── reconocRostros.py
│   └── Haar cascade XML files
├── Presentaciones/
│   └── course presentation files
├── reconocCancer.py
└── requerimientos.txt

Getting Started

1. Create a Python environment

The pinned dependencies are old enough that a Python version compatible with TensorFlow 2.3.1 is recommended. If installation fails on a modern Python version, try Python 3.7 or another version supported by TensorFlow 2.3.1.

python -m venv .venv
source .venv/bin/activate
pip install -r requerimientos.txt

2. Run a script from its folder

Most scripts use relative paths, so run them from the directory that contains their input files.

cd "Procesamiento de Imagenes"
python deteccionBordes.py

Another example:

cd "clasificacion (banano - manzana) "
python clasifBM.py

For the license plate examples:

cd reconocimientoPlacas
python detectarCaracteres.py

Some scripts open GUI windows with cv2.imshow, so they require a desktop environment with display support.

Configuration

No environment variables, API keys, or secret configuration files were found in the repository. The examples rely on local image/video files and, for webcam detection, access to a local camera.

Usage Notes

  • reconocimientoRostro/reconocRostros.py uses the default webcam with cv2.VideoCapture(0) and exits when q is pressed.
  • reconocCancer.py expects image folders such as data/train/malignant, data/train/benign, data/test/malignant, and data/test/benign. Those folders are not included here.
  • Some OpenCV calls use the OpenCV 3 return signature, such as _, contours, _ = cv2.findContours(...). Running these scripts with newer OpenCV versions may require small compatibility changes.
  • Several folders contain spaces, accents, or a trailing space in the folder name, so quote paths in shell commands.

Results / Outputs

Expected outputs vary by script:

  • Image processing scripts display processed images, masks, contours, filtered images, histograms, or transformed views.
  • Classification scripts print training/test effectiveness or predicted labels to the console.
  • Plate recognition scripts print KNN/SVM predictions and display annotated frames.
  • The automatic grader computes a score from detected answers.
  • The face detection script displays webcam frames with rectangles around detected faces and eyes.

Limitations

  • The repository is not packaged as an installable Python module.
  • There is no automated test suite.
  • Many scripts are exploratory course examples with hardcoded local filenames.
  • The cancer-classification dataset is referenced but not included.
  • Dependency versions are dated and may require an older Python environment.
  • Some scripts may need updates to run with current OpenCV/TensorFlow versions.

Future Improvements

  • Add a small compatibility layer for OpenCV 3/4 differences.
  • Move repeated image-processing helpers into reusable modules.
  • Add command-line arguments for input image/video paths.
  • Document expected datasets for examples that rely on external data.
  • Add lightweight smoke tests for functions that do not require GUI windows.
  • Provide example output images for the main demos.

About

Datos y código para el curso de Computer Vision y Machine Learning con Python

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages