imageprocessing/guidedVectorize.c
int followReferenceFeature(POINT_T* pRefHead,POINT_T** pPtrRefTail, 
			   POINT_T * pHead,POINT_T** pPtrTail,
			   BYTE* image,int width,int height,
			   int tolerance)
{
  int count = 1;  /* return value; we have one point, namely the head*/
  char message[256];
  POINT_T * pNew = NULL;
  POINT_T * pRefCurrent = pRefHead->next;
  POINT_T * pRefPrior = pRefHead;
  int xFound = 0;  /* coordinates of points found */
  int yFound = 0;
  int direction = 0;
  while (pRefCurrent != NULL) 
    {
    //direction = calculateDirection(pRefPrior->x,pRefPrior->y,pRefCurrent->x,pRefCurrent->y);
    if (pNew == NULL)
       direction = calculateDirection(pRefPrior->x,pRefPrior->y,pHead->x,pHead->y);
    else
       direction = calculateDirection(pRefPrior->x,pRefPrior->y,pNew->x,pNew->y);
 
    pNew = findPoint(image,width,height,pRefCurrent->x, 
		     pRefCurrent->y,tolerance,direction);
    if (pNew == NULL) /* no next point */
       break; 
    /* check connectivity between this point and the last one */
    /* SKIP for now */
    /**
    if (!isConnected(image,width,height,*pPtrTail,pNew,tolerance))
      {
      free(pNew);
      break;
      }
    **/
    (*pPtrTail)->next = pNew;
    pNew->prev = *pPtrTail;
    *pPtrTail = pNew;
    count++;
    *pPtrRefTail = pRefCurrent;
    pRefPrior = pRefCurrent;
    pRefCurrent = pRefCurrent->next;
    }   
  if (pRefCurrent != NULL)  /* find the true tail */
    {
    while (pRefCurrent != NULL)
	{
	*pPtrRefTail = pRefCurrent;
	pRefCurrent = pRefCurrent->next;
	}
    }
  return count;
}
/* Try to match reference feature points to white pixels in the
 * image. We check the start and end of each line segment in
 * the reference feature against the image, subject to the tolerance
 * radius. If we find a match, we check that there is a connected
 * line between the two points.
 * @param pRefHead   First point in the reference feature
 * @param pPtrRefTail Used to set the tail of ref feature - for free fn
 * @param pHead      First point in the experimental feature
 * @param pPtrTail   Pointer to pointer to the tail, which this function will change.
 * @param image  BYTE array of image data
 * @param width  Width of the image
 * @param height Height of the image
 * @param tolerance Radius of point search in pixels
 * @return number of points in the experimental feature
 */
Try to match reference feature points to white pixels in the
image. We check the start and end of each line segment in
the reference feature against the image, subject to the tolerance
radius. If we find a match, we check that there is a connected
line between the two points.
@param pRefHead   First point in the reference feature
@param pPtrRefTail Used to set the tail of ref feature - for free fn
@param pHead      First point in the experimental feature
@param pPtrTail   Pointer to pointer to the tail, which this function will change.
Try to match reference feature points to white pixels in the image . We check the start and end of each line segment in the reference feature against the image subject to the tolerance radius . If we find a match we check that there is a connected line between the two points . @param pRefHead First point in the reference feature @param pPtrRefTail Used to set the tail of ref feature - for free fn @param pHead First point in the experimental feature @param pPtrTail Pointer to pointer to the tail which this function will change .
int followReferenceFeature(POINT_T* pRefHead,POINT_T** pPtrRefTail, 
			   POINT_T * pHead,POINT_T** pPtrTail,
			   BYTE* image,int width,int height,
			   int tolerance)
{
  int count = 1;  
  char message[256];
  POINT_T * pNew = NULL;
  POINT_T * pRefCurrent = pRefHead->next;
  POINT_T * pRefPrior = pRefHead;
  int xFound = 0;  
  int yFound = 0;
  int direction = 0;
  while (pRefCurrent != NULL) 
    {
    if (pNew == NULL)
       direction = calculateDirection(pRefPrior->x,pRefPrior->y,pHead->x,pHead->y);
    else
       direction = calculateDirection(pRefPrior->x,pRefPrior->y,pNew->x,pNew->y);
    pNew = findPoint(image,width,height,pRefCurrent->x, 
		     pRefCurrent->y,tolerance,direction);
    if (pNew == NULL) 
       break; 
    (*pPtrTail)->next = pNew;
    pNew->prev = *pPtrTail;
    *pPtrTail = pNew;
    count++;
    *pPtrRefTail = pRefCurrent;
    pRefPrior = pRefCurrent;
    pRefCurrent = pRefCurrent->next;
    }   
  if (pRefCurrent != NULL)  
    {
    while (pRefCurrent != NULL)
	{
	*pPtrRefTail = pRefCurrent;
	pRefCurrent = pRefCurrent->next;
	}
    }
  return count;
}
int followReferenceFeature ( POINT_T * pRefHead , POINT_T * * pPtrRefTail , POINT_T * pHead , POINT_T * * pPtrTail , BYTE * image , int width , int height , int tolerance ) { int count = 1 ; char message [ 256 ] ; POINT_T * pNew = NULL ; POINT_T * pRefCurrent = pRefHead -> next ; POINT_T * pRefPrior = pRefHead ; int xFound = 0 ; int yFound = 0 ; int direction = 0 ; while ( pRefCurrent != NULL ) { if ( pNew == NULL ) direction = calculateDirection ( pRefPrior -> x , pRefPrior -> y , pHead -> x , pHead -> y ) ; else direction = calculateDirection ( pRefPrior -> x , pRefPrior -> y , pNew -> x , pNew -> y ) ; pNew = findPoint ( image , width , height , pRefCurrent -> x , pRefCurrent -> y , tolerance , direction ) ; if ( pNew == NULL ) break ; ( * pPtrTail ) -> next = pNew ; pNew -> prev = * pPtrTail ; * pPtrTail = pNew ; count ++ ; * pPtrRefTail = pRefCurrent ; pRefPrior = pRefCurrent ; pRefCurrent = pRefCurrent -> next ; } if ( pRefCurrent != NULL ) { while ( pRefCurrent != NULL ) { * pPtrRefTail = pRefCurrent ; pRefCurrent = pRefCurrent -> next ; } } return count ; }
Try to match reference feature points to white pixels in the
 image.
Try to match reference feature points to white pixels in the image .
/* return value; we have one point, namely the head*/ /* coordinates of points found */ //direction = calculateDirection(pRefPrior->x,pRefPrior->y,pRefCurrent->x,pRefCurrent->y); /* no next point */ /* check connectivity between this point and the last one */ /* SKIP for now */ /**
    if (!isConnected(image,width,height,*pPtrTail,pNew,tolerance))
      {
      free(pNew);
      break;
      }
    **/ /* find the true tail */