#include <OptIm32.h>
Inheritance diagram for SomeName::OptIm32:
This class provides functionality and data for analyzing features of images of size 31x31 or less.
One bit is used to represent each pixel, and is either "on" (black) or "off" (white). Additional "meta" information about each row and column is also maintained, including the number of holes and the number of black pixels. This information can be used to create very efficient feature-detection algorithms.
The 'str' method is a useful debugging tool that shows the information maintained within an instance of this class in a very concise fashion. An example of the output for the call:
optim->str('#','.',7)
which generates:
0111110 0 #...... 1 0 #...... 1 0 #...... 1 0 #...... 1 1 #.###.. 4 1 ##...#. 3 1 #.....# 2 1 #.....# 2 0 .#####. 5 8222222
assuming that 'optim' is an Image* represents a 'b'. The numbers around the borders are interpreted as follows:
IMPORTANT: A "hole" in a line is a sequence of contiguous zero's (off or white bits) enclosed in 1's (on or black bits) on BOTH sides.
Public Member Functions | |
OptIm32 (const Image *image, const ImageArgs &config) | |
OptIm32 (const std::vector< unsigned int > &rows, u1 width=PixelLine32::MaxPixels) | |
const u1 & | width () const |
const std::vector< PixelLine32 > & | cols () const |
const std::vector< PixelLine32 > & | rows () const |
void | init (const std::vector< unsigned int > &rows, u1 width) |
int | rblack (u1 i) const |
Number of black pixels in row 'i'. | |
int | rholes (u1 i) const |
Number of holes in row 'i'. | |
int | cblack (u1 i) const |
Number of black pixels in column 'i'. | |
int | choles (u1 i) const |
Number of holes in column 'i'. | |
std::string | str (char on= '#', char off= '.') const |
Static Public Member Functions | |
static void | test (int argc=0, const char *argv[]=NULL) |
Protected Member Functions | |
void | widthIs (const u1 &width) |
void | colsIs (const std::vector< PixelLine32 > &cols) |
void | rowsIs (const std::vector< PixelLine32 > &rows) |
std::string | rawstr (const std::vector< PixelLine32 > &vec, char on= '1', char off= '0', unsigned char size=PixelLine32::MaxPixels) const |
|
Create printable representation of this OptIm. See the class comments for more details. |