00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
#ifndef _LIBCP_CHAINCODE_H_
00026
#define _LIBCP_CHAINCODE_H_
00027
00028
#include <cstring>
00029
#include <vector>
00030
00031
using namespace std;
00032
00033
#include "globals.h"
00034
#include "dataobject.h"
00035
00036
namespace LIBCP{
00037
00038
static const int RIGHT = 0;
00039
static const int UP = 1;
00040
static const int LEFT = 2;
00041
static const int DOWN = 3;
00042
00043
static const int FOREGROUND = G-1;
00044
static const int BACKGROUND = 0;
00045
static const int SEEN = 100;
00046
00051 struct ChainCodeImage{
00052
int x;
00053
int y;
00054
int width;
00055
int height;
00056
int minX;
00057
int minY;
00058
int maxX;
00059
int maxY;
00060
int originX;
00061
int originY;
00062
int perimeter;
00063 vector<int> *chain;
00064 };
00065
00066
00075 class ChainCode :
public DataObject
00076 {
00077
public:
00078
~ChainCode();
00079
void addChainCodeImage(vector<int> *chain,
00080
const int x,
const int y,
00081
const int xMin,
const int yMin,
00082
const int xMax,
const int yMax);
00083 vector<ChainCodeImage*>*
getChainCodeImages();
00084
ChainCodeImage*
getMajor();
00085
static ChainCode*
createChainCode();
00086
00087
00088
private:
00089
ChainCode();
00090 vector<ChainCodeImage*> *m_chainCodeImages;
00091
00092 };
00093
00094 }
00095
00096
#endif