Ejemplo n.º 1
0
int imageClassifier::classify(IplImage *src)
{
  // input: binary image, IplImage, any bit depth, 1 channel
  // output: set classified image to 'classImg'
  // return: 0
  //
  // Classify 'src' image by putting "labels" (1 to 0xff-1 (8bit image case) value, inclusive) to region in IplImage format.

  CvScalar currentPixel;
  int i, j;

  // clone src to classImg
  classImg = cvCloneImage(src);

  // search
  for(i=0; i<src->width; i++)
    for(j=0; j<src->height; j++)
      {
	currentPixel = cvGet2D(classImg, j, i);

	// if current pixel is white (not labeled pixel)
	if(currentPixel.val[0] == WHITE)
	  {
	    labelling(i, j, NONE);
	    labelIncrement();
	  }
      }

  return 0;
}
Ejemplo n.º 2
0
int imageClassifier::classify(IplImage *src)
{
  CvScalar currentPixel;
  int i, j;

  // clone src to classImg
  classImg = cvCloneImage(src);

  // search
  for(i=0; i<src->width; i++)
    for(j=0; j<src->height; j++)
      {
	currentPixel = cvGet2D(classImg, j, i);

	// if current pixel is white (not labeled pixel)
	if(currentPixel.val[0] == WHITE)
	  {
	    labelling(i, j, NONE);
	    labelIncrement();
	  }
      }

  return 0;
}