Table of Contents

Introduction to Image Processing with Pytorch

Python, numpy and PyTorch will be used for the MPV labs. In case you are not familiar with them, study the following parts of the "Intro to numpy", "A Beginner-Friendly Guide to PyTorch and How it Works from Scratch", Pytorch for numpy users, |numpy for matlab users

Introduction into PyTorch Image Processing.

To fulfil this assignment, you need to submit these files (all packed in one .zip file) into the upload system:

  • imagefiltering.ipynb - a notebook for data initialisation, calling of the implemented functions and plotting of their results (for your convenience, will not be checked).
  • imagefiltering.py - file with the following methods implemented:
    • gaussian1d, gaussian_deriv1d - functions for computing Gaussian function and its first derivative.
    • filter2d, - function for applying 2d filter kernel to image tensor
    • gaussian_filter2d, spatial_gradient_first_order - functions for Gaussian blur and 1st order image spatial gradient computation
    • affine, - function for transforming 3 points in the image into affine transformation matrix
    • extract_affine_patches, - function extraction of the patches, defined by affine transform A.

Use template of the assignment. Use backup-template of the assignment.

When preparing a zip file for the upload system, do not include any directories, the files have to be in the zip file root.

How to setup your environment

Follow instructions on this page: Python and PyTorch Development

Basics of Image Processing in PyTorch

import torch.nn.functional as F
with torch.no_grad():
    out = F.conv2d(in, weight)

Convolution, Image Smoothing and Gradient

References

Gaussian derivatives

Geometric Transformations and Interpolation of the Image

References

Geometric transformations - review of course Digital image processing
Geometric transformations - hierarchy of transformations, homogeneous coordinates

Checking Your Results

You can check results of the functions required in this lab using the Jupyter notebook imagefiltering.ipynb.