예제 #1
0
int main(int argc, char *argv[])
{
  int numFaces, i, width, height;
  struct FaceLocation *locArray;
  struct FaceLocation loc;
  unsigned char *buf;

  if (argc!=2) { 
    fprintf(stderr,"Must give .gif file name on command line.\n");
    exit(1);
  }
  SetDataPath(argv[0]);

  fprintf(stderr,"Loading image...\n");
  buf=LoadGifToBuffer(argv[1],&width,&height);

  fprintf(stderr,"\nFinding all faces in image...\n");
  numFaces=Astro_FindAllFaces(width,height,buf,&locArray);
  if (numFaces==0) fprintf(stderr,"No faces found.\n"); else
  {
    fprintf(stderr,"%d faces found:\n",numFaces);
    for (i=0; i<numFaces; i++)
      fprintf(stderr,"  (%d,%d)-(%d,%d)\n",
              locArray[i].x1,locArray[i].y1,
              locArray[i].x2,locArray[i].y2);
    free((char*)locArray);
  }
  return 0;
}
예제 #2
0
int main(int argc, char *argv[])
{
  int numFaces, i, x, y;
  struct FaceEyeLocation *locArray;
  int width, height;
  unsigned char *buf, *mask;
  if (argc!=2) {
  	 fprintf(stderr,"Usage: siemens_test filename.pgm\n");
    exit(1);
  }

  SetDataPath(argv[0]);

  fprintf(stderr,"Loading image...\n");
  buf=LoadPgmToBuffer(argv[1],&width,&height);
  mask=(unsigned char*)malloc(width*height);

  fprintf(stderr,"\nFinding all faces in image (with mask)...\n");
  for (i=0; i<width*height; i++) mask[i]=1; /* Search nowhere */
  /* uncomment mask code here to make it search part of image */
#if 0
  for (x=170; x<220; x++) for (y=180; y<230; y++)
    mask[y*width+x]=0; /* Keep first face in ../test/henry.pgm */
  for (x=220; x<270; x++) for (y=110; y<150; y++)
    mask[y*width+x]=0; /* Keep second face in ../test/henry.pgm */
#endif
  numFaces=Siemens_FindAllFaces(width,height,buf,mask,&locArray);
  if (numFaces==0) fprintf(stderr,"No faces found.\n"); else
  {
    fprintf(stderr,"%d faces found:\n",numFaces);
    for (i=0; i<numFaces; i++)
    {
      fprintf(stderr,"  (%d,%d)-(%d,%d)\n",
              locArray[i].x1,locArray[i].y1,
              locArray[i].x2,locArray[i].y2);
      fprintf(stderr,"    Left Eye: ");
      if (locArray[i].left==-1) fprintf(stderr,"too small\n");
      if (locArray[i].left==0) fprintf(stderr,"not found\n");
      if (locArray[i].left==1) fprintf(stderr,"(%d,%d)\n",
                                       locArray[i].leftx,locArray[i].lefty);
      fprintf(stderr,"    Right Eye: ");
      if (locArray[i].right==-1) fprintf(stderr,"too small\n");
      if (locArray[i].right==0) fprintf(stderr,"not found\n");
      if (locArray[i].right==1) fprintf(stderr,"(%d,%d)\n",
                                        locArray[i].rightx,locArray[i].righty);
    }
    free((char*)locArray);
  }
  free((char*)buf);
  free((char*)mask);
  return 0;
}
예제 #3
0
bool CEsmOptions::ReadFromRegistry (void) {
  CWinApp* pApp = AfxGetApp();
  CString  Buffer;
  bool	   Result;

	/* General options */
  Buffer = pApp->GetProfileString(ESMSCR_REGSEC_GENERAL, ESMSCR_REGENTRY_AUTHORNAME, NULL);
  SetAuthorName(Buffer);

  Buffer = pApp->GetProfileString(ESMSCR_REGSEC_GENERAL, ESMSCR_REGENTRY_DATAPATH, NULL);
  SetDataPath(Buffer);
  TerminatePath(m_DataPath);

  if (Buffer.IsEmpty()) {
    FindMWRegistryPath();
  }
  else {
    SetMWDataPath(Buffer);
  }

  m_BackupSaves    = (pApp->GetProfileInt(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_BACKUPSAVES,    m_BackupSaves) != 0);
  m_AllowExtFuncs  = (pApp->GetProfileInt(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_ALLOWEXTFUNCS,  m_AllowExtFuncs) != 0);
  m_StrictIDs      = (pApp->GetProfileInt(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_STRICTIDS,      m_StrictIDs) != 0);
  m_AllowBloodmoon = (pApp->GetProfileInt(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_ALLOWBLOODMOON, m_AllowBloodmoon) != 0);
  m_AllowTribunal  = (pApp->GetProfileInt(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_ALLOWTRIBUNAL,  m_AllowTribunal) != 0);

	/* Script options */
  m_ScriptWarnLevel    = pApp->GetProfileInt(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_WARNLEVEL,     m_ScriptWarnLevel);
  m_NoScriptFormat     = (pApp->GetProfileInt(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_NOSCRFORMAT,  m_NoScriptFormat) != 0);
  m_UseExtraFile       = (pApp->GetProfileInt(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_USEEXTRAFILE, m_UseExtraFile) != 0);
  m_NoScriptPrompt     = (pApp->GetProfileInt(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_NOSCRPROMPT,  m_NoScriptPrompt) != 0);
  m_InitialIndentLevel = (pApp->GetProfileInt(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_INITIALINDENTLEVEL,  m_InitialIndentLevel) != 0);
  m_IndentCommentsMore = (pApp->GetProfileInt(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_INDENTCOMMENTSMORE,  m_IndentCommentsMore) != 0);
  m_ScriptFormatType   = pApp->GetProfileInt(ESMSCR_REGSEC_SCRIPT,  ESMSCR_REGENTRY_SCRFORMAT,    m_ScriptFormatType);

  Buffer = pApp->GetProfileString(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_EXTRAFILE, m_ExtraFile);
  SetExtraFile(Buffer);

  Buffer = pApp->GetProfileString(ESMSCR_REGSEC_SCRIPT, ESMSCR_REGENTRY_SCRIPTINDENTSTRING, m_ScriptIndentString);
  SetScriptIndentString(Buffer);

	/* Script user format */
  Result = m_UserScriptOptions.ReadFromRegistry();
  return (Result);
 }
예제 #4
0
int main(int argc, char *argv[])
{
  int numFaces, i;
  struct FaceLocation *locArray;
  struct FaceLocationOrientation *locOrientArray;
  int width, height;
  unsigned char *buf;
  if (argc!=2) {
    fprintf(stderr,"Usage: imgray_test filename.pgm\n");
    exit(1);
  }
  SetDataPath(argv[0]);
  fprintf(stderr,"Loading image...\n");
  buf=LoadPgmToBuffer(argv[1],&width, &height);
  fprintf(stderr,"Processing image...\n");
  numFaces=Informedia_FindFacesGray(width,height,buf,&locArray);
  if (numFaces==0) fprintf(stderr,"No faces found.\n"); else {
    fprintf(stderr,"%d faces found:\n",numFaces);
    for (i=0; i<numFaces; i++)
      fprintf(stderr,"  (%d,%d)-(%d,%d)\n",
              locArray[i].x1,locArray[i].y1,
              locArray[i].x2,locArray[i].y2);
    free((char*)locArray);
  }
  fprintf(stderr,"\nProcessing image (with orientations)...\n");
  numFaces=Informedia_FindFacesOrientationGray(width,height,buf,
                                               &locOrientArray);
  if (numFaces==0) fprintf(stderr,"No faces found.\n"); else {
    fprintf(stderr,"%d faces found:\n",numFaces);
    for (i=0; i<numFaces; i++)
      fprintf(stderr,"  (%d,%d)-(%d,%d) dir=%d\n",
              locOrientArray[i].x1,locOrientArray[i].y1,
              locOrientArray[i].x2,locOrientArray[i].y2,
              locOrientArray[i].orientation);
    free((char*)locArray);
  }
  free((char*)buf);
  return 0;
}