Example #1
0
FEATURE_SET Classify::ExtractPicoFeatures(TBLOB *Blob) {
/*
 **	Parameters:
 **		Blob		blob to extract pico-features from
 **		LineStats	statistics on text row blob is in
 **	Globals:
 **		classify_norm_method	normalization method currently specified
 **	Operation: Dummy for now.
 **	Return: Pico-features for Blob.
 **	Exceptions: none
 **	History: 9/4/90, DSJ, Created.
 */
  LIST Outlines;
  LIST RemainingOutlines;
  MFOUTLINE Outline;
  FEATURE_SET FeatureSet;
  FLOAT32 XScale, YScale;

  FeatureSet = NewFeatureSet(MAX_PICO_FEATURES);
  Outlines = ConvertBlob(Blob);
  NormalizeOutlines(Outlines, &XScale, &YScale);
  RemainingOutlines = Outlines;
  iterate(RemainingOutlines) {
    Outline = (MFOUTLINE) first_node (RemainingOutlines);
    ConvertToPicoFeatures2(Outline, FeatureSet);
  }
  if (classify_norm_method == baseline)
    NormalizePicoX(FeatureSet);
  FreeOutlines(Outlines);
  return (FeatureSet);

}                                /* ExtractPicoFeatures */
Example #2
0
/**
 * Operation: Dummy for now.
 *
 * Globals:
 * - classify_norm_method normalization method currently specified
 * @param Blob blob to extract pico-features from
 * @return Pico-features for Blob.
 * @note Exceptions: none
 * @note History: 9/4/90, DSJ, Created.
 */
    FEATURE_SET Classify::ExtractPicoFeatures(TBLOB * Blob) {
        LIST Outlines;
        LIST RemainingOutlines;
        MFOUTLINE Outline;
        FEATURE_SET FeatureSet;
        FLOAT32 XScale, YScale;

        FeatureSet = NewFeatureSet(MAX_PICO_FEATURES);
        Outlines = ConvertBlob(Blob);
        NormalizeOutlines(Outlines, &XScale, &YScale);
        RemainingOutlines = Outlines;
        iterate(RemainingOutlines)
        {
            Outline = (MFOUTLINE) first_node(RemainingOutlines);
            ConvertToPicoFeatures2(Outline, FeatureSet);
        }
        if (classify_norm_method == baseline)
            NormalizePicoX(FeatureSet);
        FreeOutlines(Outlines);
        return (FeatureSet);

    }                                /* ExtractPicoFeatures */
Example #3
0
FEATURE_SET Classify::ExtractOutlineFeatures(TBLOB *Blob) {
/*
 **	Parameters:
 **		Blob		blob to extract pico-features from
 **		LineStats	statistics on text row blob is in
 **	Globals: none
 **	Operation: Convert each segment in the outline to a feature
 **		and return the features.
 **	Return: Outline-features for Blob.
 **	Exceptions: none
 **	History: 11/13/90, DSJ, Created.
 **		05/24/91, DSJ, Updated for either char or baseline normalize.
 */
  LIST Outlines;
  LIST RemainingOutlines;
  MFOUTLINE Outline;
  FEATURE_SET FeatureSet;
  FLOAT32 XScale, YScale;

  FeatureSet = NewFeatureSet (MAX_OUTLINE_FEATURES);
  if (Blob == NULL)
    return (FeatureSet);

  Outlines = ConvertBlob (Blob);

  NormalizeOutlines(Outlines, &XScale, &YScale);
  RemainingOutlines = Outlines;
  iterate(RemainingOutlines) {
    Outline = (MFOUTLINE) first_node (RemainingOutlines);
    ConvertToOutlineFeatures(Outline, FeatureSet);
  }
  if (classify_norm_method == baseline)
    NormalizeOutlineX(FeatureSet);
  FreeOutlines(Outlines);
  return (FeatureSet);
}                                /* ExtractOutlineFeatures */
/*---------------------------------------------------------------------------*/
FEATURE_SET ExtractPicoFeatures(TBLOB *Blob, LINE_STATS *LineStats) {
/*
 **	Parameters:
 **		Blob		blob to extract pico-features from
 **		LineStats	statistics on text row blob is in
 **	Globals:
 **		classify_norm_method	normalization method currently specified
 **	Operation: Dummy for now.
 **	Return: Pico-features for Blob.
 **	Exceptions: none
 **	History: 9/4/90, DSJ, Created.
 */
  LIST Outlines;
  LIST RemainingOutlines;
  MFOUTLINE Outline;
  FEATURE_SET FeatureSet;
  FLOAT32 XScale, YScale;

  FeatureSet = NewFeatureSet (MAX_PICO_FEATURES);

  Outlines = ConvertBlob (Blob);

  NormalizeOutlines(Outlines, LineStats, &XScale, &YScale);
  RemainingOutlines = Outlines;
  iterate(RemainingOutlines) {
    Outline = (MFOUTLINE) first_node (RemainingOutlines);
    /*---------Debug--------------------------------------------------*
    OFile = fopen ("f:/ims/debug/pfOutline.logCPP", "r");
    if (OFile == NULL)
    {
      OFile = Efopen ("f:/ims/debug/pfOutline.logCPP", "w");
      WriteOutline(OFile, Outline);
    }
    else
    {
      fclose (OFile);
      OFile = Efopen ("f:/ims/debug/pfOutline.logCPP", "a");
    }
    WriteOutline(OFile, Outline);
    fclose (OFile);
    *--------------------------------------------------------------------*/
    ConvertToPicoFeatures2(Outline, FeatureSet);
  }
  if (classify_norm_method == baseline)
    NormalizePicoX(FeatureSet);
  /*---------Debug--------------------------------------------------*
  File = fopen ("f:/ims/debug/pfFeatSet.logCPP", "r");
  if (File == NULL)
  {
    File = Efopen ("f:/ims/debug/pfFeatSet.logCPP", "w");
    WriteFeatureSet(File, FeatureSet);
  }
  else
  {
    fclose (File);
    File = Efopen ("f:/ims/debug/pfFeatSet.logCPP", "a");
  }
  WriteFeatureSet(File, FeatureSet);
  fclose (File);
  *--------------------------------------------------------------------*/
  FreeOutlines(Outlines);
  return (FeatureSet);

}                                /* ExtractPicoFeatures */