APL (Dyalog), 27 bytes
((3 3⍴⊢,1↓⊖)>∘3 5 1 7,2∘|)¨
The output format is a little bit weird: this function returns an array containing two shape-3,3 arrays each containing 0s and 1s.
((3 3⍴⊢,1↓⊖)>∘3 5 1 7,2∘|)¨
The output format is a little bit weird: this function returns an array containing two shape-3,3 arrays each containing 0s and 1s.