Chain code object allocation
#include "dip_chaincode.h"
dip_Error dip_ChainCodeNew ( chaincode, resources )
Allocates an object of type dip_ChainCode. However, since its fields are private and currently there exist only read access functions, it is of little use creating such an object.
A dip_ChainCode object stores the following data:
Data type | Name | Description |
dip_int | startX | Start coordinates for chain, ChainCodeGetStart |
dip_int | startY | Start coordinates for chain, ChainCodeGetStart |
dip_int | label | Label ID of object, ChainCodeGetLabel |
dip_int | connectivity | Connectivity of chain, ChainCodeGetConnectivity |
dip_int | number | Number of elements in chain, ChainCodeGetSize |
dip_Chain * | chain | Pointer to first element in chain, ChainCodeGetChains |
The dip_Chain structure has the following elements:
Data type | Name | Description |
dip_uint8 | code | Direction of step taken from previous to this pixel (Freeman code) |
dip_Boolean | border | Pixel is on the border |
dip_Chain * | next | Pointer to the next element in the chain |
The chain parameter points to the first dip_Chain object in the chain, which points to the next through its next value. The last element in the chain has a NULL pointer.
Each chain element contains the code value (between 0 and 3 or between 0 and 7, depending on the connectivity) as well as a border value, which indicates whether the pixel is on the edge of the image or not. The border value is important because it indicates that the object is cut by the imaging window and needs to be treated differently.
The chain code for an object always has as many elements as the object has border pixels.
Data type | Name | Description |
dip_ChainCode * | chaincode | Receives pointer to allocated structure |
dip_Resources | resources | Resources tracking structure. See ResourcesNew |
ImageChainCode, ChainCodeFree, ChainCodeArrayNew, ChainCodeArrayFree, ChainCodeGetSize, ChainCodeGetChains, ChainCodeGetStart, ChainCodeGetLabel, ChainCodeGetConnectivity, ChainCodeGetLength, ChainCodeGetLongestRun, ChainCodeGetFeret