This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.


Find output bounds for spatial transformation


outbounds = findbounds(TFORM,inbounds)


outbounds = findbounds(TFORM,inbounds) estimates the output bounds corresponding to a given spatial transformation and a set of input bounds. TFORM, as returned by maketform, is a spatial transformation structure. inbounds is a 2-by-num_dims matrix. The first row of inbounds specifies the lower bounds for each dimension, and the second row specifies the upper bounds. num_dims has to be consistent with the ndims_in field of TFORM.

outbounds has the same form as inbounds. It is an estimate of the smallest rectangular region completely containing the transformed rectangle represented by the input bounds. Since outbounds is only an estimate, it might not completely contain the transformed input rectangle.

More About

collapse all


findbounds gets called by imtransform if 'XData' and 'YData', the parameters that control the output-space bounding box in imtransform, are not specified. findbounds computes the output-space bounding box.


  1. findbounds first creates a grid of input-space points. These points are located at the center, corners, and middle of each edge in the image.

    I = imread('rice.png');
    h = imshow(I);
    axis on, grid on
    in_points = [ ...
        0.5000    0.5000
        0.5000  256.5000
      256.5000    0.5000
      256.5000  256.5000
        0.5000  128.5000
      128.5000    0.5000
      128.5000  128.5000
      128.5000  256.5000
      256.5000  128.5000];
    hold on
    hold off

    Grid of Input-Space Points

  2. Next, findbounds transforms the grid of input-space points to output space. If tform contains a forward transformation (a nonempty forward_fcn field), then findbounds transforms the input-space points using tformfwd. For example:

    tform = maketform('affine', ...
        [1.1067 -0.2341 0; 0.5872 1.1769 0; 1000 -300 1]);
    out_points = tformfwd(tform, in_points)
    The output appears below:
    out_points =
      1.0e+003 *
        1.0008   -0.2995
        1.1512    0.0018
        1.2842   -0.3595
        1.4345   -0.0582
        1.0760   -0.1489
        1.1425   -0.3295
        1.2177   -0.1789
        1.2928   -0.0282
        1.3593   -0.2088

    If TFORM does not contain a forward transformation, then findbounds estimates the output bounds using the Nelder-Mead optimization function fminsearch.

  3. Finally, findbounds computes the bounding box of the transformed grid of points.

Introduced before R2006a

Was this topic helpful?