1
$\begingroup$

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 &1 &0\\ 1 &1 &0\\ 0 &0 &1 \end{array} \right], $$ whose inverse doesn't exist.

(I am guessing that the transform matrix is changed by adding or subtracting some values)

$\endgroup$
1
$\begingroup$

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
$\endgroup$
  • $\begingroup$ If the only option is to not do the mapping, yes. Sometimes other regularization constraints are placed on the mapping which forces $T$ to be non-singular. $\endgroup$ – Peter K. Oct 21 '15 at 12:30
  • $\begingroup$ There exist there different generalized inverses for different purposes, and the term generalized inverse is sometimes used (hence ginv) for pseudo inverses. The book Generalized Inverses: Theory and Applications provides an extensive background. $\endgroup$ – Laurent Duval Oct 21 '15 at 13:03
  • $\begingroup$ @LaurentDuval Do you mean where does it come from? library(MASS) $\endgroup$ – Peter K. Oct 21 '15 at 13:05
  • 1
    $\begingroup$ My mistake, the comment is now complete $\endgroup$ – Laurent Duval Oct 21 '15 at 13:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.