Esempio n. 1
0
IplImage* imageClassifier::getRegionImg(IplImage *src, int x, int y)
{
  // input: binary image, IplImage, (recommend 8 bit depth and 1 channel)
  //        a coordinate which is contained in region you want to get, int
  // return: region image, IplImage, binary image
  //         or 0 if coordinate is invalid (out of iamge size or there are no region)
  //
  // Take binary image, classify sorce image's white regions separated by black pixels,
  // and return the region which contain pixel (x, y).

  IplImage *tmp;

  // set WHITE and LABEL_MAX (need to automate lator)
  WHITE = 255;
  LABEL_MAX = 254;

  // clone image src to tmp
  tmp = cvCloneImage(src);

  // convert tmp to binary image (for safety)
  cvThreshold(tmp, tmp, WHITE/2, WHITE, CV_THRESH_BINARY);

  // classify
  classify(tmp);

  // release
  cvReleaseImage(&tmp);

  // get region
  return getRegionByCoordinate(x, y);
}
Esempio n. 2
0
IplImage* imageClassifier::getRegionImg(IplImage *src, int x, int y)
{
  IplImage *tmp;

  // set WHITE and LABEL_MAX (need to automate lator)
  WHITE = 255;
  LABEL_MAX = 254;

  // clone image src to tmp
  tmp = cvCloneImage(src);

  // convert tmp to binary image (for safety)
  cvThreshold(tmp, tmp, WHITE/2, WHITE, CV_THRESH_BINARY);

  // classify
  classify(tmp);

  // release
  cvReleaseImage(&tmp);

  // get region
  return getRegionByCoordinate(x, y);
}