# Identifying 3D shape from matrices analytically

I have a set of matrices (a 3D matrix, that represents a quantized body), for instance: (the size 5x5 here is just an example, the real size is a lot higher)

$M_1 = \left[ {\begin{array}{cc} 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 1 & 0 & 0 \\ 0 & 1 & 1 & 1 & 0 \\ 0 & 0 & 1 & 1 & 0 \\ 0 & 0 & 1 & 1 & 0 \\ \end{array} } \right] M_2 = \left[ {\begin{array}{cc} 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 1 & 0 \\ 0 & 0 & 1 & 1 & 0 \\ 0 & 0 & 0 & 0 & 0 \\ \end{array} } \right] M_3 = \left[ {\begin{array}{cc} 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 \\ \end{array} } \right]$

. . .

$M_n = \left[ {\begin{array}{cc} 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 1 & 1 \\ 0 & 0 & 1 & 1 & 1 \\ 0 & 0 & 0 & 1 & 1 \\ \end{array} } \right]$

Each matrix represents a black white image, and each matrix from $M_1$ to $M_2$, $M_2$ to $M_3$ and so on are continuous until $M_n$. All matrices will always have the same number of rows and columns. The 1 represents white pixel while 0 represents black pixel. We can understand how the shape looks like in 3D by drawing rendering it on the screen, but for a computer program, this has to be treated differently. I am looking for a mathematical way to make a program understand a 3D shape in this case. Note that these matrices will always only hold one continuous 3D shape, but the shape can be of any shape.

Several things that come to my mind, for instance:

Area: I can count how many white pixels are there for this. It's a dirty solution, but for a completely random 3D shape, is there another method?

Surface: I can use edge detection algorithm and count only the white pixels from there.

These are a few basic things, but for a more complex identification, such as "are there some extending parts from the bigger part?", etc. There are infinite ways to address a random 3D shape, but in mathematics, is there anything I can do if I want to identify how random 3D shapes look like analytically?

-
Feature-detection formulae and algorithms depend on precisely which types of features are sought after. There's probably a fantastic litany of different features you could look for: bumps, holes, inflections, saddles, geodesics. Of course if you're literally working in only $5\times 5\times n$ voxels of grainedness, you're probably not guaranteed anything useful. –  anon Jul 24 '11 at 15:29
the size 5x5 here is just for example sake, the real size is a lot bigger. –  Karl Jul 24 '11 at 15:41
I figured that was more realistically the case. –  anon Jul 24 '11 at 15:43
Rather than "a set of matrices" this should be regarded as a 3D matrix, that represents a quantized body. This is a 3D version of the (much simpler, but still quite difficult) problem of identifying shapes in black-white images. Google "shape detection" I doubt you will get any practical answer unless you restrict somewhat your problem. –  leonbloy Jul 24 '11 at 16:31
Your 3-D shapes are what are referred to as Voxel representations and fall into the domain of image processing. If you Google Voxel you will get going in the right direction. –  Tpofofn Jul 25 '11 at 11:17