1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
# include <stdio.h>
# include <stddef.h>
# include <stdlib.h>
# include "bitmap.h"
typedef struct DataRun
{
int drX0;
int drX1;
int drRepeatCount;
} DataRun;
typedef struct SegmentEdge
{
struct SegmentNode * seFrom;
struct SegmentNode * seTo;
DataRun * seRuns;
short int seRunCount;
} SegmentEdge;
typedef struct SegmentNode
{
SegmentEdge ** snUpEdges;
SegmentEdge ** snDownEdges;
short int snUpEdgeCount;
short int snDownEdgeCount;
int snY0;
int snY1;
} SegmentNode;
/************************************************************************/
/* */
/* A 'segment' as discovered during the segmentation process. */
/* */
/* NOTE that conceptually there is a similarity with the graph */
/* resulting from the skeleton of a component. In this */
/* implementation, the is no relationship however. */
/* */
/************************************************************************/
typedef struct BitmapSegment
{
int bsX0;
int bsX1;
int bsY0;
int bsY1;
short int bsNodeCount;
short int bsEdgeCount;
SegmentNode ** bsNodes;
SegmentEdge ** bsEdges;
} BitmapSegment;
/************************************************************************/
/* */
/* Routine declarations. */
/* */
/************************************************************************/
extern int bcComponents( BitmapSegment *** pSegments,
int * pCount,
const unsigned char * buffer,
const BitmapDescription * bd );
extern int bmcDrawComponent( const BitmapSegment * bs,
unsigned char * buffer,
int col0,
int row0,
int bytesPerRow,
int colorEncoding );
extern void bmcStatistics( const BitmapSegment * bs,
int * pN,
float * pSx,
float * pSy,
float * pSxx,
float * pSyy,
float * pSxy );
|