Skip to content

viktor-ko/image_analysis

Repository files navigation

Image Analysis for Mapping

These Python scripts were created for the WS 2022/23 "Image Analysis for Mapping" course from the Cartography MSc. at the Technical University of Munich (TUM). They demonstrate different image analysis and processing techniques to extract information from images and use it in common mapping tasks.

Project Structure

  • image_analysis.py: Main script that executes functions from modules below.
  • basic_img_operations.py: Functions for basic image operations such as loading, visualizing, splitting, merging, and inverting images.
  • img_filters.py: Functions for applying different image filters: box, binomial, median, Sobel, and Laplacian.
  • morphology.py: Functions for morphological operations: erosion, dilation, opening, closing.
  • extraction_regions_edges.py: Functions for extracting edges and regions using techniques like region growing, watershed transformation, mean shift segmentation, SLIC superpixels, Douglas-Peucker algorithm, and Hough transformation.
  • ./images: Directory containing sample images used in the project.
  • src_mat.npy: Sample matrix used in morphological operations.

Dependencies

  • NumPy
  • OpenCV
  • Matplotlib
  • Scikit-image

Covered Topics

1. Image representations and basic operations

1.1 Color scales

bgr_rgb_gray

1.2 Spilt and merge image channels

r_g_b_merge

1.3 Point operation - Inversion

inverted

1.4 Image Histograms

normal_over_under histogram histogram_color

2. Image filters

2.1 Padding and Convolution

padding_convolution

2.2 Image smoothing - Box, Binomial and Median Filters

box_binomial_median_filters

2.3 Sobel Filter

sobel_filter

2.4 Laplacian Filter

laplacian_filter

3. Morphological operations

3.1 Erosion, Dilation, Opening, Closing

erosion_dilation_opening_closing

3.2 Road extraction

road_extraction

3.3 Get the car and fill the road

car_road_fill

3.4 Get the edge of the road

road_edge

3.5 Get the center line of the road (Distance Transformation and Skeletonization)

road_center

3.6 Final result

morph_result

4. Extraction of edges and regions

4.1 Region Growing algorithm

region_growing

4.2 Watershed Transformation

watershed

4.3 Mean Shift Segmentation

mean_shift

4.4 Simple Linear Iterative Clustering (SLIC) superpixels algorithm

slic_superpixels

4.5 Douglas Peuke Algorithm

douglas_peuke

4.6 Hough transformation

hough_transform