matlab图像处理 Introduction to MATLAB

本文详细介绍了在MATLAB环境下进行图像处理的基本概念和技术,包括矩阵操作、图像绘图、编程基础以及卷积、高斯函数、梯度计算、图像平滑等关键步骤。同时,还探讨了几何变换和插值技术,如仿射变换和图像拉伸。通过实施一系列MATLAB函数,读者可以掌握图像处理和几何变换的核心技巧。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Introduction to MATLAB

The MATLAB environment and programming language will be used intensively during the MPV labs. In case you are not familiar with basics of this environment, study the following parts of the "Getting started with MATLAB (MathWorks)":

  • Matrices and Arrays - (Expressions, Working with Matrices, More About Matrices and Arrays)
  • Graphics - (Editing Plots, Mesh and Surface Plots, Images)
  • Programming - (Flow Control, Other Data Structures, Scripts and Functions)

(home study)

Another useful tutorials are:

"Getting started with MATLAB (Indiana University)"

"Matlab Tutorial (Clarkson University)"

Revision of Basics of Image Processing

Another important precondition of the MPV labs is the basics of image processing in MATLAB.

Convolution, Image Smoothing and Gradient

  • The Gaussian function is often used in image processing as a model of ideal point, low pass filter for noise reduction or so-called windowing function for weighting contribution of points in the neighbourhood. Write an implementation of the function  G=gauss(x,sigma) that computes discrete samples of Gaussian
    Graph
    in points given by vector with variance  Graph and zero mean.
  • Implement function  D=dgauss(x,sigma) that returns a discrete samples of first derivation of Gaussian
    Graph
    v in points given by vector with variance  Graph and zero mean.
  • Get acquainted with the function  conv2.
  • The effect of filtering with Gaussian can be studied on an impulse response:
    sigma = 6.0;
    x = [-ceil(3.0*sigma):ceil(3.0*sigma)];
    G = gauss(x, sigma);
    D = dgauss(x, sigma);
    imp = zeros(51); imp(25,25) = 255;
    out = conv2(G,G,imp);
    ...
    
    imagesc(out); % or surf(out);

    try to find out impulse responses of other combinations of the Gaussian and its derivatives.

  • Examples of impulse responses: 
     
  • Write a function  out=gaussfilter(in,sigma) that implements smoothing of an input image  in with a Gaussian filter of width  2*(sigma*3.0)+1 and variance  Graph and returns the smoothed image  out (e.g.  Lenna). Exploit the separability property of Gaussian filter and implement the smoothing as two convolutions with one dimensional Gaussian filter (see function  conv2).
  • Modify function gaussfilter to a new function  [dx,dy]=gaussderiv(in,sigma) that returns the estimate of the gradient (gx, gy) in each point of the input image  in (MxN matrix) after smoothing with Gaussian with variance  Graph. Use either first derivative of Gaussian or the convolution and symmetric difference to estimate the gradient.
  • Implement function  [dxx,dxy,dyy]=gaussderiv2(in,sigma) that returns all second derivatives of input image  in (MxN matrix) after smoothing with Gaussian of variance  Graph.

References

Geometric Transformations and Interpolation of the Image

  • Implement function  A=affine(x1,y1,x2,y2,x3,y3) that returns 3×3 transformation matrix A which transforms point in homogeneous coordinates from canonical coordinate system into image: (0,0,1)→(x1,y1,1), (1,0,1)→(x2,y2,1), (0,1,1)→(x3,y3,1). 

  • Write function  out=affinetr(in,A,ps,ext) that warps a patch from image  in (MxN matrix) into canonical coordinate system. Affine transformation matrix  A (3×3 elements) is a transformation matrix from the canonical coordinate system into image from previous task. The parameter  ps defines the dimensions of the output image (the length of each side) and  ext is a real number that defines the extent of the patch in coordinates of the canonical coordinate system. E.g. out=affinetr(in,A,41,3.0), returns the patch of size 41×41 pixels that corresponds to the rectangle (-3.0,-3.0)x(3.0,3.0) in the canonical coordinate system. Top left corner of the image has coordinates (0,0). Use bilinear interpolation for image warping. Check the functionality on  image

What should you upload?

All the functions implemented in tasks of this lab in Matlab: gauss.mdgauss.mgaussfilter.mgaussderiv.mgaussderiv2.m,affine.m a affinetr.m upload into the upload system as a .zip archive. Keep all functions in the root of the .zip archive together with all helper your functions required. Follow closely the specification and order of the input/output arguments.

References

Checking Your Results

You can check results of the functions required in this lab using the Matlab function publish. Copy the test script test.minto MATLAB path (directory with implemented functions) a run. Compare your results to the reference solution (updated 16.2.2011, 18:10).


from: https://cw.fel.cvut.cz/wiki/courses/ae4m33mpv/labs/1_intro/start

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值