How to shift rows left-right or column up-down in datatable
I have been working on a project in which I get a text file after image processing on
a rectangular sheet which I import in DataTable.
If my rectangular sheet while measurement is kept straight then my datatable after import looks like
1 1 1 1 1 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0
However, if my rectangular sheet while measurement is tilted little bit left or right then i get something like
0 0 0 0 1 1 1 1 1 0
0 0 0 1 1 1 1 1 0 0
0 0 1 1 1 1 1 0 0 0
0 1 1 1 1 1 0 0 0 0
1 1 1 1 1 0 0 0 0 0
How can I determine how much my rectangle is tilted and based on that straighten up my datatable like
1 1 1 1 1 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0
What I have tried:
I have tried cell by cell opertation from one datatable to another but not efficient. Please help.
Thanks and Regards
Rahul