hCell is a C++ dynamic link library, which allows representing raster images via hexagonical picture elements instead of classical quadratic ones. This leads to hexagonical neighborhood system, where each picture element has 6 equidistant neighbors. Such neighborhood system finds its application in computer vision and pattern recognition problems. Also, the library is well suited for creating artistic photo manipulation effects. The code is written entirely in Microsoft Visual C++ with using the OpenCV library.
In this example we compare two coarse versions of one image represented via quadratic and hexagon cells. The original image has resolution of 800×800 pixels, i.e. the whole amount of pixels is 640.000. Both coarse versions have approximately the same number of pixels (cells) equal to 25.600, i.e. each pixel (cell) of coarse image has color value equal to the average value of 25-pixel patch of the original image. In case of quadratic cells representation, this patch is a square of 5×5 pixels. In case of hexagon cells – it is a hexagon with an edge length equal to 3,102, so its area is exactly 25 pixels. For this example, both coarse images were enlarged to fit the size of the original image:
This example illustrates the application of the library for obtaining creative photo manipulation effects. The original image of a flower is represented as a mosaic. Two versions of this mosaic are depicted: first one – the mosaic with uniform cell size; and the second – with mosaic with cells of 3 different sizes:
If you have applied the hCell library in your work and achieved some interesting results, please send them to me via email@example.com, so I could allocate them at this web-page. This will help us to spread and improve the library. We thank you in advance for your support.
An Inspiring Video
Significant part of the inspiration for creating this library I have derived from this video