亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? neighbor.c

?? feret人臉圖象數據庫處理代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*-----------------------------------------------------    PROGRAM : neighbor.c  DATE    : 6/15/94  AUTHOR  : Wasiuddin Wahid, wasi@media.mit.edu  NOTE    : Baback added Bayesian Similarity Metric (7/23/96)  _____________________________________________________  PROGRAM DESCRIPTION HERE  ____________________________________________________*/#include <stdio.h>#include <stdlib.h>#include <string.h>#include <math.h>#include <float.h>#include "util.h"#include "io.h"#define OPTIONS "m:x:k:l:o:n:t:c:a:b:z:p:s:"#define MAX_CHARS 1024#define MAX_NDIM  1024  /* for static storage in bayesian_distance() */char *usage = "\t-m dir_known_faces -x dir_test_faces\n\t\\t\t-k list_known_faces -l list_test_faces\n\t\\t\t-o output_file -t threshold [-n top_n_matches]\n\t\\t\t[-c conf] [-a lower coeff] [-b upper coeff]\n\t\\t\t[-z intra/extra_dir] [-p P0] [-s sigmoid_scale]";char *help = " Nearest Neighbor Pattern Matching\n-m dir_known_faces  \t directory of  known faces \n\-x dir_test_faces   \t directory of test faces \n\-k list_known_faces \t list file of known faces \n\-l list_test_faces  \t list file of test faces\n\-o output_file      \t output file\n\-n top_n_matches    \t print out top N matches only (default: print all)\n\-t threshold        \t found flag threshold(default: 10)\n\-c conf             \t confidence factor (default: 1000)\n\-a lower coeff      \t lower coefficient (default: first)\n\-b upper coeff      \t upper coefficient (default: last)\n\-z intra_extra_dir  \t Bayesian metric with intra/extra_kl.bf in dir\n\-p P0               \t intra prior P0  (default = 0.5)\n\-s sigmoid_scale    \t sigmoid scale factor for Bayesian (default = 1.0)\n\n";extern int optind;extern char *optarg;/*------- command line defaults ------- */float conf_factor = 1e3;float sigmoid_scale = 1.0;/* Definition of the structures I will be using :   A tface(test_face) consists of the name of file    containing the test face and a pointer to the    structure the test face and a pointer to the    structure "match"   A match is a structure containing the name of the file   to which the test face is similar, the distance from   that face and a pointer to the next matched face */typedef struct match *Matchptr;typedef struct match{  char *name;  float distance;  Matchptr next;} Match;typedef struct tface {  char *name;  Matchptr similar;} Tface;typedef struct kface{  char *name;  float *coeffs;} Kface;typedef struct bstruct{  float **intra_kl;  float **extra_kl;  float logP0;  float logP1;  float logD0;  float logD1;  int   N;  int   a,b;} Bayesian;  int number_files(char list[]);float find_distance(float *test, float *known, int no);Matchptr add_match(Matchptr root, Matchptr new, int n);void print_match(Tface *faces, int n, int no_files, char out[], float thres, char comline[]);/* Begin Hack for feret test */int print_file(Tface faces, int n, FILE *fout, float thres, int count);void kill_list(Matchptr list);int empty_list(Matchptr list);/*end feret hack */float bayesian_distance(float *test, float *known, int N, Bayesian *B);/* globals */int do_bayesian = 0;/*char *strdup(char *s);*//*______________________MAIN____________________________*/main(int argc, char **argv){  int no_files, no_kfiles, total_no_points, no_points;  int file_no, point, i,j, c, n=10, rec, a=1, b=0, count =0;  char *progname, comline[MAX_CHARS];    char known_dir[MAX_CHARS];  char test_dir[MAX_CHARS];  char klist[MAX_CHARS];  char tlist[MAX_CHARS];  char out_file[MAX_CHARS];  char line[MAX_CHARS];  char kfile[MAX_CHARS];  char tfile[MAX_CHARS];  char the_kfile[MAX_CHARS];  FILE *fknown, *ftest, *fklist, *ftlist, *fout;  Tface *faces;  Kface *kfaces;  Matchptr a_match;  float *t_points, a_point, dist, thres, *weights, weight;  char intra_extra_dir[MAX_CHARS];  char filename[MAX_CHARS];  Bayesian B_struct;  float P0 = 0.5;  float P1 = 0.5;   /* default equal priors */  float fval; /* Required input flags */  int errflag  = 0;  int inflag   = 0;  int testflag = 0;  int kflag    = 0;  int tflag    = 0;  int outflag  = 0;  int nflag    = 0;  int thresflag= 0;    progname = argv[0];  for (i=0; i<argc; i++){    strcat(comline, argv[i]), strcat(comline, " ");  }  while ( (c = getopt(argc, argv, OPTIONS)) != EOF)    switch(c){    case 'm':      strcpy(known_dir, optarg);      inflag = 1;      break;          case 'x':      strcpy(test_dir, optarg);      testflag = 1;      break;    case 'k':      strcpy(klist, optarg);      kflag = 1;      break;    case 'l':      strcpy(tlist, optarg);      tflag = 1;      break;          case 'o':      strcpy(out_file, optarg);      outflag = 1;      break;    case 'n':      n = atoi(optarg);      nflag = 1;      break;          case 't':      thres = atof(optarg);      thresflag = 1;      break;    case 'c':      conf_factor = atof(optarg);      break;          case 'a':      a = atoi(optarg);      break;          case 'b':      b = atoi(optarg);      break;     case 'z':      strcpy(intra_extra_dir, optarg);      do_bayesian = 1;      break;    case 's':      sigmoid_scale = atof(optarg);      break;         case 'p':      P0 = atof(optarg);      if (P0>1) {	fprintf(stderr,		"ERROR: Prior P0 (%f) must be less than 1\n\n", P0);	exit(0);      }      P1 = 1.0 - P0;      break;    case '?':      errflag = 1;      break;      } /* switch (c){ */    /* Command line check */  if (errflag || !inflag || !testflag || !thresflag || !kflag || !tflag || !outflag){    fprintf(stderr, "\nUSAGE: %s %s\n %s\n\n", progname, usage, help);    exit(1);  }    /* fprintf(stderr, "the n is %i", n); */  /* Calculate no. of test and known faces */  no_files = number_files(tlist);  no_kfiles = number_files(klist);    /* -- default printout is all --- */  if (nflag==0)    n = no_kfiles;  faces = (Tface *) calloc(no_files, sizeof(Tface));  if (faces == NULL){    fprintf(stderr, "\nERROR: Memory cannot be allocated\n\n");    exit(3);  }  kfaces = (Kface *) calloc(no_kfiles, sizeof(Kface));  if (kfaces == NULL) {    fprintf(stderr, "\nERROR: Memory cannot be allocated\n\n");    exit(3);  }  /* Calculate the total_no of eigenvectors & create array of points */   if ( (ftlist = fopen(tlist, "r")) == NULL){    fprintf(stderr, "\nERROR: Input file %s cannot be opened \n\n", tlist);    exit(2);  }  fscanf(ftlist, "%s", line);    while ( ! ( (strncmp(line, "#", 1) !=0) && (strlen(line) > 1) )){    fscanf(ftlist, "%s", line);  }    sprintf(tfile, "%s/%s", test_dir, line);  if ( (ftest = fopen(tfile, "r")) == NULL){    fprintf(stderr, "\nERROR: Input file %s cannot be opened\n\n", tfile);    exit(2);  }  no_points = 0;  while ( (fscanf(ftest, "%s", line)) != EOF){    no_points++;  }  total_no_points = no_points;  t_points=(float *) calloc(no_points, sizeof(float));  if (t_points == NULL){    fprintf(stderr, "\nERROR: Memory could not be allocated\n\n");    exit(3);  }  /*Read in all the known data into the array of kfaces */  if ( (fklist = fopen(klist, "r")) == NULL){    fprintf(stderr, "\nERROR: Input file %s cannot be opene\n\n", klist);    exit(2);  }  file_no = 0;  while ( (fscanf(fklist, "%s", line)) != EOF){    if ( (strncmp(line, "#", 1) != 0) || (strlen(line) > 1)){      kfaces[file_no].name = strdup(line);      kfaces[file_no].coeffs = (float *) calloc(no_points, sizeof(float));      sprintf(kfile, "%s/%s", known_dir, line);      point = 0;      if ( (fknown = fopen(kfile, "r")) == NULL){	fprintf(stderr, "\nERROR: Input file %s cannot be opened", kfile);	exit(2);      }      while ( (fscanf(fknown, "%f", &a_point) != EOF)){	kfaces[file_no].coeffs[point] = a_point;	point++;      }      file_no++;      fclose(fknown);    }  }  fclose(fklist);       /*  If b hasn't been specified then it defaults to the end */  /* i.e. b = no_points                                      */  if (!b){    b = total_no_points;  }    /* the no of points relevant in the distance calculation is */  /* difference between a & b                                 */  /* setup range for bayesian */  if (do_bayesian) {     B_struct.a     = a;      B_struct.b     = b;  }  else     no_points = b-a+1;  /* setup intra_extra stuff */  if (do_bayesian) {        int m,n;    float fval=0;    P0 = P0/(P0+P1);    P1 = P1/(P0+P1); /* make sure priors are ok */    B_struct.logP0 = log(P0);    B_struct.logP1 = log(P1);    /* intra/extra_kl.bf files are MxN matrices with format       1st row is the transpose of the Xmean       rows [2,N+1] are the transpose of eigenvectors U       last row (N+2) is the corresponding eigenvalues  */        /* read intra_kl file */    sprintf(filename, "%s/intra_kl.bf", intra_extra_dir);    B_struct.intra_kl = read_BIN(filename, &m, &n);    B_struct.N = n;    if ((m != n+2)) {      fprintf(stderr,	      "intra_kl.bf dimensions [%d,%d] are not correct, should be [%d,%d]\n\n", m, n, n+2, n);      exit(1);    }    if ((b > n)) {      fprintf(stderr,	      "intra_kl.bf dimensions [%d,%d] don't match range [%d,%d]!\n\n", m, n, a, b);      exit(1);    }    /* read extra_kl file */    sprintf(filename,"%s/extra_kl.bf", intra_extra_dir);    B_struct.extra_kl = read_BIN(filename, &m, &n);    if ((m != n+2)) {      fprintf(stderr,	      "extra_kl.bf dimensions [%d,%d] are not correct, should be [%d,%d]\n\n", m, n, n+2, n);      exit(1);    }    if ((n != B_struct.N)) {      fprintf(stderr,	      "extra_kl.bf dimensions [%d,%d] don't match intra_kl.bf [%d,%d]\n\n", m, n, m, B_struct.N);      exit(2);    }    if ((total_no_points != B_struct.N)) {      fprintf(stderr,	      "intra/extra_kl.bf dimensionality (%d) doesn't match data dimensionality (%d)\n\n", B_struct.N, total_no_points);      exit(3);    }    /* compute log of the denominators (over [a,b] range only!) */    fval = 0;    for (i=B_struct.a; i<=B_struct.b; i++)      fval += log(B_struct.intra_kl[B_struct.N+2][i]);    B_struct.logD0 = 0.5 * fval;    fval = 0;    for (i=B_struct.a; i<=B_struct.b; i++)      fval += log(B_struct.extra_kl[B_struct.N+2][i]);    B_struct.logD1 = 0.5 * fval;      }  a = a-1;     /* To compensate for arrays indexing from zero */  /* For each face in the test_dir, find it's neighbors in the known_dir */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产色爱av资源综合区| 久久精品视频在线看| 欧美日韩中文字幕精品| 一本色道久久加勒比精品| 色播五月激情综合网| 欧美亚洲日本一区| 91.xcao| 久久久不卡网国产精品一区| 久久众筹精品私拍模特| 中文字幕一区二区不卡| 亚洲成人免费在线| 久久99蜜桃精品| 成人91在线观看| 欧美日韩美女一区二区| 欧美电影免费提供在线观看| 中文字幕中文在线不卡住| 一区二区三区中文字幕在线观看| 日韩制服丝袜先锋影音| 丁香婷婷综合五月| 欧美日韩一区久久| 国产欧美综合在线| 日本美女一区二区三区视频| 成人福利在线看| 欧美一区二区视频在线观看| 国产精品全国免费观看高清| 日韩精品色哟哟| 99精品视频在线观看| 精品国内二区三区| 一区二区三区欧美视频| 成人精品免费网站| 久久嫩草精品久久久久| 午夜伦欧美伦电影理论片| 波多野结衣一区二区三区| 欧美成人伊人久久综合网| 午夜精品久久久久久不卡8050| 丁香桃色午夜亚洲一区二区三区| 欧美日韩精品一区二区| 亚洲精品免费在线观看| 丁香网亚洲国际| 欧美激情综合在线| 国产一区二区三区久久久| 精品久久免费看| 毛片不卡一区二区| 日韩视频免费观看高清在线视频| 亚洲成a人片综合在线| 欧美在线视频你懂得| 日本一区二区综合亚洲| 国产精品资源在线观看| 久久欧美中文字幕| 国产九色精品成人porny| 欧美成人三级电影在线| 捆绑调教美女网站视频一区| 欧美日本一道本在线视频| 天天综合日日夜夜精品| 制服丝袜一区二区三区| 天天射综合影视| 久久久九九九九| 91视频免费播放| 亚洲综合区在线| 在线播放/欧美激情| 欧美bbbbb| 中文字幕色av一区二区三区| 91麻豆精品视频| 日本三级亚洲精品| 久久免费精品国产久精品久久久久| 国产一区二区精品久久| 日韩视频免费观看高清完整版在线观看| 亚洲精品亚洲人成人网| 欧美男人的天堂一二区| 人人精品人人爱| 26uuu国产在线精品一区二区| 国产福利精品一区| 亚洲欧美另类综合偷拍| 欧美一二三区精品| 国产成人av电影免费在线观看| 中文字幕一区二区三区在线不卡 | 欧美精品高清视频| 美国十次了思思久久精品导航| 亚洲精品一区二区三区香蕉| 天天色综合成人网| 欧美国产禁国产网站cc| 欧美色精品天天在线观看视频| 蜜桃视频在线一区| 日本一区二区不卡视频| 欧美网站大全在线观看| 国产夫妻精品视频| 麻豆国产欧美日韩综合精品二区| 国产女人aaa级久久久级| 在线观看三级视频欧美| 精品亚洲aⅴ乱码一区二区三区| 亚洲欧美成人一区二区三区| 久久日韩粉嫩一区二区三区| 91麻豆福利精品推荐| 成人中文字幕在线| 久久精品国产一区二区三| 久久精品男人的天堂| 日韩一区二区电影网| 欧美视频一二三区| 99久久精品国产导航| 国产精品影音先锋| 九九国产精品视频| 美女高潮久久久| 日韩精品电影在线观看| 亚洲国产日韩精品| 最好看的中文字幕久久| 欧美国产一区在线| 国产网站一区二区三区| 久久综合九色欧美综合狠狠| 日韩一区二区精品葵司在线| 日韩欧美国产一区在线观看| 91.麻豆视频| 欧美一级二级在线观看| 日韩欧美电影在线| 日韩免费观看高清完整版 | 国产精品美女久久久久久2018| 久久久综合激的五月天| 国产精品久久精品日日| 亚洲欧美日韩成人高清在线一区| 亚洲精品美国一| 亚洲一区二区三区影院| 日韩高清欧美激情| 国产一区二区三区四 | 91在线观看高清| a级精品国产片在线观看| 99综合电影在线视频| 欧美丝袜丝交足nylons图片| 91精品在线免费观看| 精品国产3级a| 亚洲免费观看高清完整| 日本在线不卡一区| 国产成人日日夜夜| 一本高清dvd不卡在线观看| 欧美日韩视频一区二区| 精品少妇一区二区三区免费观看 | www.视频一区| 欧美精品一卡两卡| 国产精品乱码妇女bbbb| 麻豆精品在线播放| 91香蕉国产在线观看软件| 制服丝袜成人动漫| 久久久欧美精品sm网站| 综合分类小说区另类春色亚洲小说欧美 | 欧美日韩精品一区二区| 精品处破学生在线二十三| 自拍av一区二区三区| 日本欧洲一区二区| 91尤物视频在线观看| 久久久国际精品| 美日韩黄色大片| 在线看不卡av| 欧美国产欧美综合| 久久超碰97中文字幕| 日韩欧美中文字幕一区| 亚洲国产综合人成综合网站| 成人国产精品免费| 日韩免费观看高清完整版| 午夜电影网一区| 日本韩国一区二区三区视频| 亚洲国产高清不卡| 国产激情一区二区三区| 亚洲精品一区二区三区四区高清 | 亚洲精品一二三四区| 麻豆精品一区二区综合av| 欧美v日韩v国产v| 日韩不卡一二三区| 在线亚洲一区观看| 亚洲猫色日本管| www.日韩精品| 亚洲免费成人av| 日本一区二区不卡视频| 一区二区三区四区视频精品免费| 国产精品18久久久久久久久| 久久综合狠狠综合| 国产一二精品视频| 国产精品理论片在线观看| 激情亚洲综合在线| 亚洲欧洲另类国产综合| 色婷婷狠狠综合| 日韩精品亚洲专区| 欧美r级在线观看| av高清久久久| 亚洲一线二线三线视频| 久久精品一区蜜桃臀影院| 99久久免费视频.com| 亚洲超碰精品一区二区| 欧美mv日韩mv国产网站app| 国产精品综合二区| 欧美美女一区二区在线观看| 亚洲图片欧美激情| 美女脱光内衣内裤视频久久影院| 欧美一区二区三区在线| 蜜臀av性久久久久蜜臀aⅴ四虎| 精品少妇一区二区三区视频免付费 | 成人久久久精品乱码一区二区三区| 亚洲欧洲综合另类| 日韩欧美一级二级三级| 99麻豆久久久国产精品免费| 亚洲一区二区四区蜜桃| 国产精品网站在线播放| 欧美日韩免费不卡视频一区二区三区|