angeligareta / image-segmentation-overview

Image Segmentation projects developed for the Image Processing, Analysis, and Classification course at UPM. Implemented using OpenCV and C++.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Image Segmentation Overview

Projects developed for the Image Processing, Analysis And Classification course of the EIT Digital data science master at UPM

UPM License

Introduction

The exercises developed in the area of image segmentation are the following:

  • Contour extraction: Extract contour from an image using the morphological operations of erosion or dilation. (Exercise 1a)
  • Grassfire propagation algorithm: Detect all the flatzones in the image and output them with different random colors. (Exercise 1b)
  • Teeth count from gear: Given an image of a gear, this program will output an approximate teeth number. (Exercise 2a)
  • Watershed markers: Apply watershed algorithm. (Exercise 2b)
  • Flatzone detection: Given pixel coordinates, neighborhood connectivity and region label, detect the flat zone where the origin pixel is and output an image with that region colored with the input label. (Exercise 11)
  • Regional minimum and maximum: Given pixel coordinates and neighborhood connectivity, output if the origin pixel is a regional minimum, regional maximum or nothing. (Exercise 13a and 13b)

Environment

This exercises have been developed in the following environment:

  • Cmake version: 3.15
  • C++ minimum required version: 14
  • OpenCV version: 4.3.0
  • OS: Ubuntu (Linux)

Project structure

The project is structured as:

  • data: Contains all the images that serve as input examples for the developed programs.
  • programs: Compiled version of src programs.
  • src: Contains all the code with an utils folder and the main programs for the exercises.
  • CMakeLists.txt: Used to compile with cmake.

How to use

  • Flatzone:
./programs/exercises_11_a_flatzone ./data/immed_gray_inv_20051218_frgr4.txt ./data/immed_gray_inv_20051218_frgr4.pgm ./output/immed_gray_inv_20051218_frgr4_flatzone_57_36.jpg
./programs/exercises_11_a_flatzone ./data/gran01_64.txt ./data/gran01_64.pgm ./output/gran01_64_0_0.jpg
  • Regional minimum:
./programs/exercises_13_a_minimum ./data/immed_gray_inv_20051218_frgr4_min_01.txt ./data/immed_gray_inv_20051218_frgr4.pgm ./output/exercise_13a_output_01.txt
./programs/exercises_13_a_minimum ./data/immed_gray_inv_20051218_frgr4_min_02.txt ./data/immed_gray_inv_20051218_frgr4.pgm ./output/exercise_13a_output_02.txt
  • Regional maximum:
./programs/exercises_13_b_maximum ./data/immed_gray_inv_20051218_frgr4_max_01.txt ./data/immed_gray_inv_20051218_frgr4.pgm ./output/exercise_13b_output_01.txt
./programs/exercises_13_b_maximum ./data/immed_gray_inv_20051218_frgr4_max_02.txt ./data/immed_gray_inv_20051218_frgr4.pgm ./output/exercise_13b_output_02.txt
  • Contour extraction:
./programs/exercises_01_a_contour_extraction ./data/hitchcock.png ./output/hitchcock_contour.png
  • Grassfire propagation algorithm:
./programs/exercises_01_b_grassfire ./data/particles.png ./output/particles_regions.png
  • Teeth count from gear:
./programs/exercises_02_a_wheel_teeth_count ./data/wheel.png ./output/wheel_teeth.txt
  • Watershed markers:
./programs/exercises_02_b_watershed ./data/coffee_grains.jpg ./output/coffee_markers.jpg

Author

About

Image Segmentation projects developed for the Image Processing, Analysis, and Classification course at UPM. Implemented using OpenCV and C++.

License:MIT License


Languages

Language:C++ 92.2%Language:CMake 7.8%