Inverse mapping (affine transformation) for singular transform matrix I was reading DIP by Gonzalez et al, and came across the concept of getting output image pixel values by calculating nearest neighbour in input image by inverse mapping of output pixel coordinates $(x,y)$ to input coordinates $(v,w)$ and applying its value. Something like

$$
(v,w) = T^{-1} (x,y)
$$
where $T$ is the image transform matrix.

But what if the matrix T is singular. How will we define the nearest neighbour pixels then?
For eg. for 

$$
T = \left [
\begin{array}{ccc}
1 &amp;1 &amp;0\\
1 &amp;1 &amp;0\\
0 &amp;0 &amp;1 \end{array}
\right],
$$ whose inverse doesn't exist.

(I am guessing that the transform matrix is changed by adding or subtracting some values)
Usually, when an inverse is required but the matrix you are taking the inverse of is not guaranteed to be invertible, then the (Moore-Penrose) pseudoinverse is used:

In R, if $T$ is

T
        [,1] [,2] [,3]
[1,]    1    1    0
[2,]    1    1    0
[3,]    0    0    1


Then the pseudoinverse calculated using ginv is

ginv(T)
     [,1] [,2] [,3]
[1,] 0.25 0.25    0
[2,] 0.25 0.25    0
[3,] 0.00 0.00    1


Clearly, this won't give the identity matrix when multiplying $T$, but it's as close as you can get with $T$ singular.

T*ginv(T)
     [,1] [,2] [,3]
[1,] 0.25 0.25    0
[2,] 0.25 0.25    0
[3,] 0.00 0.00    1