Conjecture::PixFilt Class Reference

#include <PixFilt.h>

Inheritance diagram for Conjecture::PixFilt:

Conjecture::Root List of all members.

Detailed Description

Provides a generalized pixel filtering mechanism.

****************************************************************

This class acts as a 2d "bit-based regular expression", bitexp. For example, suppose we want to determine whether a particular pixel <tx,ty> within an image matches the following bitexp:

?1? 10? ?1?

In such a situation, we may want to switch the 0 to a 1. Instances of this class can describe this kind of matching and can establish whether it is true for a particular pixel position within an image.

To explain the rather esoteric data-structures, we'll describe the internal state needed to describe the above mask.

The state: _rows = 3 _yoffset = 1 _data[0] = (0x1 << 8) | ( ( 0+8)<<4 ) | 1 _data[1] = (0x10 << 8) | ( (-1+8)<<4 ) | 1 _data[2] = (0x1 << 8) | ( ( 0+8)<<4 ) | 1

SUBTLETIES ----------


Public Member Functions

 PixFilt (u1 yoffset)
 PixFilt::PixFilt (u1 yoffset, u1 mask1, int offset1)
 PixFilt::PixFilt (u1 yoffset, u1 mask1, int offset1, u1 mask2, int offset2)
 PixFilt::PixFilt (u1 yoffset, u1 mask1, int offset1, u1 mask2, int offset2, u1 mask3, int offset3)
const u2 * data () const
const u1 & rows () const
const u1 & yoffset () const
void add (u1 mask, int offset)
std::string str () const
u1 mask (u1 index) const
int offset (u1 index) const
u1 size (u1 index) const
bool match (const std::vector< u4 > &rows, u1 width, u1 x, u1 y)
bool match (const OptIm &im, u1 x, u1 y)
int filter (std::vector< u4 > &im, u1 width, bool set=true)
int filter (OptIm &im, bool set=true)

Static Public Member Functions

static void test (int argc=0, const char *argv[]=NULL)

Protected Member Functions

void rowsIs (const u1 &rows)
void yoffsetIs (const u1 &yoffset)

Static Protected Member Functions

static int ffs (u1 val)


Member Function Documentation

int Conjecture::PixFilt::ffs u1  val  )  [static, protected]
 

find-first-set: returns the bit position of the left-most on bit within 'val.

Bit 0 is on far right. The value 0x5 would return 2 because 0x5 in binary is 101 (left most 1 is bit 2). The value '0x21' would return 5 because 0x21 is binary 100001 (left most 1 is bit 5).

int Conjecture::PixFilt::filter std::vector< u4 > &  im,
u1  width,
bool  set = true
 

Apply this filter to the entire image

Parameters:
set True means turning on pixels that are off. False means turning off pixels that are on.
Returns the number of pixels changed.

bool Conjecture::PixFilt::match const std::vector< u4 > &  rows,
u1  width,
u1  x,
u1  y
 

Returns true if this PixFilt matches against <x,y> of 'im'


The documentation for this class was generated from the following files:
Generated on Thu Jun 15 19:56:11 2006 for Conjecture by  doxygen 1.4.6