Comments

Well I don't know how the matrix white is generated but I have a code for you. I took the example of a 6x6 matrix with two blocks and it works fine. Here's the code, but in your case, you should replace 3(6-3) by 2045(2048-3) in the for loops.