First, apologies for my description. I don't know the matrix semantics related to this type of operation so I cannot even begin to know how to search for it.
In matlab, I have a matrix A:
1 1 1 1 1
1 1 1 1 1
0 1 1 1 1
0 0 1 1 1
0 0 0 0 1
That I would like to transform to become something like B:
1 0 0 0 0
0 0 0 0 0
0 1 0 0 0
0 0 0 1 0
0 0 0 0 1
Where the 1's correspond to row-col locations with 1's in the 5 positions above and to the right AND [there is a single 1 either to the left or below OR both left and below positions are zero].
I can see how this might doable by iterating through each position in A, but this may be slow for very large matrices. I was wondering if there is a filter2 or xcorr2 based approach in matlab that might be faster? I tried both with various kernel matrices on a padded version of A (1-padded above and to the right, 0-padded left and below) but can't come to a definitive answer.
More answer...