Steve on Image Processing

January 31st, 2006

Spatial transformations: Terminology and notation

"Terminology and notation" - is there a more boring way to start a topic? Unfortunately it's necessary, because there is a lot of variation in terms and equations from book to book and paper to paper. Some of the "frequently-asked questions" arise from simple confusion over notations and conventions. Even the topic itself is a source of confusion. Start with either the word geometric or spatial, and then add one of these words: transform, transformation, or warp. The Image Processing Toolbox Users Guide uses spatial transformation, while Digital Image Processing Using MATLAB uses geometric transformation. I'll try to stick with spatial transformation.

This picture shows several of the most important conceptual elements:

[Edited 31-Jan-2006 to fix typo in diagram]

There are two Cartesian coordinate systems, input space and output space. I'll consistently use (u,v) for input space and (x,y) for output space.

A forward transformation, shown as T{ }, maps a location in input space to a location in output space: (x0, y0) = T{ (u0, v0) }.

A inverse transformation, shown as T-1{ }, maps a location in output space to a location in input space: (u1, v1) = T-1{ (x1, y1) }.

It's important to refer to a diagram like this. It can help you remember:

  • Is an (x,y) location in input space or output space?
  • Is the u axis horizontal or vertical?
  • Does the vertical axis point up or down?

If you compare what the Image Processing Toolbox does, or what I write here, with another reference, be sure to determine exactly what the notational conventions are in the other reference. Figure out how they differ with the toolbox conventions. That'll help you figure out why your output image is upside down, or why it was stretched in the horizontal direction when you expected it to be stretched in the vertical direction.

Please note that Digital Image Processing Using MATLAB uses (w, z) instead of (u, v) for input-space coordinates. That's because (u, v) is used elsewhere in the book as frequency-domain coordinates.

6 Responses to “Spatial transformations: Terminology and notation”

  1. philip batchelor replied on :

    Oops, typo on the Output Space? Isn’t the (u1,v1) in the picture on the right meant to be (x1,y1)? ;)

  2. Steve replied on :

    Philip - Fixed the typo. Thanks!

  3. copi replied on :

    Hello,
    In first place congratulations for your blog, an the interesting topics you are teaching about.
    Is this choice of axis vey commom?

    If you are trying to reference an 50ge to ground coordinates
    the output space axis would not be adecuate for coordinates
    in any cartographic projection system.

    And what about the input space?
    Is (column, row) more commom than (row,column)?

  4. Steve replied on :

    copi - It’s hard for me to say what is “common.” I’ve seen a variety of coordinate system conventions in use in all kinds of sources. I have the impression that coordinate systems with the horizontal coordinate first are somewhat more common in computer graphics contexts. Our choice in the Image Processing Toolbox was strongly influenced by what happens in MATLAB when you say plot(x,y). My best advice is to make sure you know what convention is used by whatever system or source you are using.

    Secondly, I would regard the relationship between MATLAB’s default image coordinate system (pixel centers on an integer grid) and a physical coordinate system as simply another step in the spatial transformation. For example, two Cartesian coordinate systems whose axes are aligned are related by an affine transformation consisting of scale factors and translations. If they aren’t aligned, you can throw in a rotation.

    Later on, I’ll talk about how to define and perform spatial transformations on images that do not lie on the default integer grid.

  5. Muhmmad Hanif replied on :

    Hi,
    Intresting to learn online about image processing. This blog realy help in many issues. can you please also post some material about 2 view mapping. like 2 view image of same scene.
    if we have two views of a partical (suppose, side view and top view) in an image, then how can we associate the pixel in top view of the scene with the pixel of side view……
    Thanks,
    Have a Nice time!
    Enjoy

  6. Steve replied on :

    Muhmmad—Thanks for topic suggestion. I don’t know anything, however, about matching up pixels from a side view to pixels from a top view.

Leave a Reply

Wrap code fragments inside <pre> tags, like this:

<pre class="code">
a = magic(3);
sum(a)
</pre>

If you have a "<" character in your code, either follow it with a space or replace it with "&lt;" (including the semicolon).


Steve Eddins manages the Image & Geospatial development team at The MathWorks and coauthored Digital Image Processing Using MATLAB. He writes here about image processing concepts, algorithm implementations, and MATLAB.

  • Sana: hi steve, could you explain to me how i would be able to use the dir function, to do a loop through a directory...
  • Nishtha: Sir, I have preprocessed the image in following steps: [1] adaptive histogram equalization [2] thresholding...
  • Kristof: I also strongly support the idea. I have just recently bumped into the problem that im2single was not...
  • Steve: David—I’ m glad you found it useful!
  • David Lalejini: I found your example very useful for finding connected nodes in a large set of input pairs. I start...
  • tommy: Dear Steve, I have a question,please if you are kind to help me regarding the accumulator array dimensions of...
  • Steve: Abc—I don’t know how to distinguish the faces. You might try posting your question in the MATLAB...
  • Manju: well if we have a few ovals within each other like in a cell how do we measure the distance from the center...
  • Steve: Manju—What do you mean? How is each region defined?
  • Manju: if we have 2-3 regions within each other how do we measure the regions of each one?

These postings are the author's and don't necessarily represent the opinions of The MathWorks.