On a recent project I had to persist image features into a database to be used on a content-based image retrieval (CBIR) system. These features included the following:
- Color - represented as histograms for each color band; each histogram consisted of 256 float numbers.
- Shape - represented as 127 Fourier coefficients (complex numbers).
- Texture - represented as an array of the top 60 peaks locations (and sign) on a 128x128 wavelet decomposition grid; the wavelet decomposition is performed in each of the three color bands.
I normally do my modeling in terms of object orientation first. I created an ImageFeatures class which had references to other classes such as Color, Shape and Texture. Each of these classes ended up holding a primitive array of float numbers for the corresponding feature data. That's all well and good. Pretty simple stuff.