Can I write a matrix description of cropping an image to a given size? It doesn't even need to be an image, simply some rectangle $\square ABCD$, and a crop boundary $\square EFGH$. Is there a representation of their intersection that could be described algebraically?
2026-03-26 12:58:02.1774529882
On
Linear algebra: is there a matrix representation of cropping an image?
332 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
2
There are 2 best solutions below
0
On
Left multiply to select rows, right multiply to select columns. E.g. if you want $$ \left( \begin{array}{cc} a_{32}&a_{33}\\ a_{42}&a_{43}\\ \end{array} \right) $$ from $$ \left( \begin{array}{c|cc|cc} a_{11}&a_{12}&a_{13}&a_{14}&a_{15}\\ a_{21}&a_{22}&a_{23}&a_{24}&a_{25}\\ \hline a_{31}&a_{32}&a_{33}&a_{34}&a_{35}\\ a_{41}&a_{42}&a_{43}&a_{44}&a_{45}\\ \hline a_{51}&a_{52}&a_{53}&a_{54}&a_{55}\\ \end{array} \right) $$ you can left multiply by $$ \left( \begin{array}{ccccc} 0&0&1&0&0\\ 0&0&0&1&0\\ \end{array} \right) $$ selecting rows 3 and 4, and right multiply by $$ \left( \begin{array}{cc} 0&0\\ 1&0\\ 0&1\\ 0&0\\ 0&0\\ \end{array} \right) $$ selecting columns 2 and 3.
It depends what you are asking for exactly. A matrix represents a linear map, in this case I will assume you mean a map $\Bbb R^2\to\Bbb R^2$.
The answer is no because linear maps must preserve the origin. Consider when $\square ABCD$ is the unit square $[0,1]\times[0,1]$ and $\square EFGH$ is any rectangle which doesn't contain the origin.
Yes. Any rectangle can be translated so that one corner is the origin. The two sides of the rectangle can be considered as vectors $u$ and $v$ (which you can visualize as arrows pointing away from the origin). Then the matrix taking $[0,1]\times[0,1]$ to the rectangle with one corner at the origin and sides formed by $u$ and $v$ is just $[u\ v]$ (here $u$ and $v$ are column vectors, so this is a $2\times 2$ matrix). We can remember where the original rectangle's corner was using another vector.
There won't be any way to avoid needing more data than just one matrix here, because in my interpretation cropping is not a linear map (but rather affine).