optimizing the distance between two matrices

126 Views Asked by At

I am stuck over a problem, and here it goes.

I have a matrix say A of size $2\times 2$ and a matrix B of the same size. Let $A=\begin{bmatrix} 2 &7\\ 9&2\end{bmatrix}$ and $B=\begin{bmatrix} 1 &5\\ 7&8\end{bmatrix}$, Now i need to rearrange $B$ in such a way that $\sum_{i,j}|A_{ij}-B_{ij}|$ is minimum. Now a possible solution can be to look for the closest number in $A$ corresponding to that same location in $B$ and place the element there. COntinue doing this for all the elements, one such solution can be $B=\begin{bmatrix} 5&7\\8&1\end{bmatrix}$, where the distance is $3+0+1+1=5$. Now my question is how to do this searching problem for bigger sized matrices? Can a Genetic algorithm be used to find out the optimal positions where we get the minimum? Can someone hint at the possible solutions that I can explore?

The idea that got me interested in this was, i was trying some recreational image steganography. Where i have a cover image $A$, and i have a secret image $B$ that i want to embed in $A$. Now, what embedding does is, it distorts the image to certain extent, which reduces the PSNR between the original cover $A$ and the stego image $A'$. So i just wanted to find out those locations in the image $A$, where if we do the embedding of the secret, the final stego-image that comes out has a higher visual quality. For that to happen, I effectively need the closeness on $A$ and $A'$, but this depends on $B$. I hope its clear now.