Reputation: 1678
I'd like to calculate an 3D object out of the 3 views. The principle is shown in following figure.
Each view is stored in a 2 dimensional matrix with binary values representing the object. The 3D object should be stored in a 3 dimensional matrix also with binary values (True: this pixel is representing object mass, False: this pixel is white space). How can I realize this with simply numpy matrix operations?
The three views a,b and c
can for example look like [[0,0,0,0],[0,1,1,0],[0,1,1,0],[0,0,0,0]]
.
Upvotes: 2
Views: 578
Reputation: 32521
If your views are a, b, c
then:
result = a[None, :, :] & b[:, None, :] & c[:, :, None]
Shuffle round the axes to suit the input
a
, b
and c
are assumed to be of the form:
np.array([[0,0,0,0],[0,1,1,0],[0,1,1,0],[0,0,0,0]], dtype=np.bool)
Upvotes: 2