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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? modelwarp_mc.c

?? feret人臉圖象數(shù)據(jù)庫(kù)處理代碼
?? C
字號(hào):
/*----------------------------------------------------------------------PROGRAM: modelwarp_mc.cDATE:    6/2/94AUTHOR:  Baback Moghaddam, baback@media.mit.edu------------------------------------------------------------------------   This routine reads in an ASCII file of the format   filename  x1 x2 x3 x4 y1 y2 y3 y4   .   .   .    and warps the images according to the affine transform   between the feature locations indicated and those in    the model.bf file   It then masks the the warped files and normalized its contrast   it the writes the results to output directory with the same names   ---------------------------------------------------------------------- */#include <stdio.h>#include <stdlib.h>#include <string.h>#include <math.h>#include <float.h>#include "util.h"#include "io.h"#include "matrix.h"#include "affine.h"#define MAX_CHARS  512/* ----------- Command-Line Parsing Stuff ------- */extern int optind;extern char *optarg;char *progname;                /* used to store the name of the program  */char comline[MAX_CHARS];       /* used to store the entire command line  */#define OPTIONS "i:l:m:o:x:y:ra:b:w:p:s:zfv:hc:d:e:"char *usage = "\t-i indir -l list -m model.bf -o outdir\n\\t\t\t[-r] [-a pt_1] [-b pt_2] [-x out_xdim] [-y out_ydim]\n\\t\t\t[-w mask.bf] [-p pedestal] [-s scale] [-f] [-z]\n\\t\t\t[-v bgvalue] [-h] [-c pt_1] [-d pt_2] [-e pt_3]\n";char *help="\Correspondance-Based Affine Warping (+ Masking & Contrast)\n\n\-i indir    \t input directory\n\-l list     \t ASCII list of filenames and their features locations\n\            \t with the following line format:\n\n\            \t   filename  i1 i2 i3 ... iN j1 j2 j3 ... jN\n\n\-m model.bf \t BF-format file of reference point coordinates\n\            \t with the following 2-by-N matrix format:\n\n\            \t   i1 i2 i3 ... iN\n\            \t   j1 j2 j3 ... jN\n\n\-o outdir   \t output directory\n\-r          \t apply rigid transform (based on default correspondances)\n\-a rigid_1  \t rigid transform feature #1 (default = 1)\n\-b rigid_2  \t rigid transform feature #2 (default = 2)\n\-x out_xdim \t output x dimension (1st n columns) of warped image\n\-y out_ydim \t output y dimension (1st n rows)    of warped image\n\-w mask.bf  \t mask file\n\-p pedestal \t pedestal for contrast normalization\n\-s scale    \t scale    for contrast normalization\n\-f          \t write float output image (default is same as input)\n\-z          \t contrast statistics computed over non-zero part of image\n\-v          \t pixel value in void regions (default = 0)\n\-h          \t apply selective 3pt affine warp\n\-c pt_1     \t selective affine warp feature #1 (default = 1)\n\-d pt_2     \t selective affine warp feature #2 (default = 2)\n\-e pt_3     \t selective affine warp feature #3 (default = 3)\n";/* --- command-line defaults --- */int do_mask      = 0;int do_contrast  = 0;int contrast_nonzero_flag   = 0;int out_float_flag = -1;  /* -1 = unspecified *//* ---- function prototypes ----- */int contrast(float **image_in, float **image_out, 	     int nrow, int ncol,	     float pedestal, float scale,	     float *mean, float *sigma);/*----------------------------------------------------------------------*/main(int argc, char **argv){   register int i,j,k,l,ii,jj;  int f, c, nframe, nfeatures, sets, bytes_pixel;  int nrow, ncol, out_nrow, out_ncol, M, N;  char command[MAX_CHARS],indir[MAX_CHARS],listfile[MAX_CHARS], \    infile[MAX_CHARS], modelfile[MAX_CHARS],outdir[MAX_CHARS], \      filename[MAX_CHARS], maskfile[MAX_CHARS], line[MAX_CHARS];  float **P, **Q, **Ps, **Qs, **W, **Winv;   float **image_in, **image_out, **mask;  unsigned char **uchar_image;  float contrast_mean, contrast_sigma;  int   contrast_npixels;  float fval1, fval2, fval;  FILE *fp, *fp2;         /* for output values dump */  /* required input flags */    int errflag   = 0;  int inflag    = 0;  int listflag  = 0;  int modelflag = 0;  int outflag   = 0;  int y_flag    = 0;  int x_flag    = 0;    /*--- command line defaults ---- */  int rigid_select = 0;  int rigid_pt_1 = 1;  int rigid_pt_2 = 2;  int affine_select = 0;  int affine_select_pt[8] = {0, 1, 2, 3, 4, 5, 6, 7};    float contrast_pedestal = -1;  /* unspecified values */  float contrast_scale    = -1;  float bgvalue = 0.0;  progname = argv[0];  for (i=0; i<argc; i++)    strcat(comline, argv[i]),strcat(comline, " ");      /* ----------------------  Command Line Parse ------------------------ */    while ((c = getopt(argc, argv, OPTIONS)) != EOF)    switch (c) {          case 'i':      strcpy(indir, optarg);      inflag = 1;      break;    case 'l':      strcpy(listfile, optarg);      listflag = 1;      break;          case 'm':      strcpy(modelfile, optarg);      modelflag = 1;      break;    case 'o':      strcpy(outdir, optarg);      outflag = 1;      break;    case 'y':      out_nrow = atoi(optarg);      y_flag = 1;      break;    case 'x':      out_ncol = atoi(optarg);      x_flag = 1;      break;    case 'r':      rigid_select = 1;      break;    case 'a':      rigid_pt_1 = atoi(optarg);      rigid_select = 1;      break;    case 'b':      rigid_pt_2 = atoi(optarg);      rigid_select = 1;      break;    case 'w':      strcpy(maskfile, optarg);      do_mask = 1;      break;    case 'p':      contrast_pedestal = atof(optarg);      break;    case 's':      contrast_scale = atof(optarg);      break;    case 'z':      contrast_nonzero_flag = 1;      break;    case 'f':      out_float_flag = 1;      break;    case 'v':      bgvalue = atof(optarg);      break;    case 'h':      affine_select = 1;      break;    case 'c':      affine_select_pt[1] = atoi(optarg);      break;    case 'd':      affine_select_pt[2] = atoi(optarg);      break;    case 'e':      affine_select_pt[3] = atoi(optarg);      break;    case '?':      errflag = 1;      break;    }    /* command line error check */    if (errflag || !inflag || !listflag || !modelflag) {    fprintf(stderr,"\nUSAGE: %s %s\n%s\n", progname, usage, help);    exit(1);  }  if (contrast_pedestal>0 & contrast_scale>0)    do_contrast = 1;  /* ----  read indir descriptor file -------- */    read_descriptor(indir, &nframe, &sets, &bytes_pixel, &ncol, &nrow);  if (sets>1)     myerror("Input files must be single-set DAT files!");  if (y_flag==0)     out_nrow = nrow;  if (x_flag==0)    out_ncol = ncol;  if (out_float_flag == -1)    out_float_flag = (bytes_pixel==4 ? 1:0);  /* ---- read model file ---- */  P = read_BIN(modelfile, &M, &nfeatures);  if (affine_select==1 && nfeatures<3) {    fprintf(stderr,	    "ERROR: selective affine warp needs atleast a 3pt-model\n");    exit(3);  }  if (affine_select==1) {    for (i=1; i<=3; i++)      if ((affine_select_pt[i] > nfeatures) || (affine_select_pt[i]<1)) {	fprintf(stderr,		"ERROR: affine_select_pt[%d]=%d is invalid for nfeatures=%d\n",		i, affine_select_pt[i], nfeatures);	exit(4);      }  }  Q = matrix(1, M, 1, nfeatures);  if (affine_select==1) {    Ps = matrix(1, 2, 1, 3);    Qs = matrix(1, 2, 1, 3);  }  W    = matrix(1, 3, 1, 3);  Winv = matrix(1, 3, 1, 3);  image_in   = matrix(1, nrow, 1, ncol);  image_out  = matrix(1, nrow, 1, ncol);  if (bytes_pixel == 1)    uchar_image = cmatrix(1, out_nrow, 1, out_ncol);  printf("\nNo. of model features = %d\n\n", nfeatures);  for (i=1; i<=M; i++) {    for (j=1; j<=nfeatures; j++)      printf("%3d ", (int) P[i][j]);    printf("\n");  }  printf("\n");     /* ---- read mask file (if called for) ---- */  if (do_mask) {    int m,n;    mask = read_BIN(maskfile, &m, &n);    if (m!=out_ncol || n!=out_nrow) {      fprintf(stderr,	      "ERROR: Mask file dimensions %d-by-%d are invalid\n",m,n);      exit(10);    }  }  /* ---- loop over input list file and warp ------- */  if ((fp = fopen(listfile, "r")) == NULL) {    fprintf(stderr,"ERROR: Could not open input file %s \n\n", listfile);    exit(1);  }  nframe = 0;  while (strlen(fgets(line, MAX_CHARS, fp))) {    if (strncmp(line, "#", 1) != 0 && strlen(line)>1) {      nframe++;          /* --- read filename and reference coordinates --- */            strcpy(infile, strtok(line, " \t"));      for (i=1; i<=nfeatures; i++)	Q[1][i] = atof(strtok(NULL, " \t"));      for (i=1; i<=nfeatures; i++)	Q[2][i] = atof(strtok(NULL, " \t"));            fprintf(stdout, "%s  ", infile);      for (i=1; i<=nfeatures; i++)	fprintf(stdout,"%3d ",  (int) Q[1][i]);      for (i=1; i<=nfeatures; i++)	fprintf(stdout,"%3d ",  (int) Q[2][i]);      fprintf(stdout,"\n");            fprintf(stdout,"Affine matrix: \n");      if (rigid_select == 1)	rigid(Q, P, nfeatures, W, rigid_pt_1, rigid_pt_2);      else if (affine_select == 0)	affine(Q, P, nfeatures, W);      else {	for (i=1; i<=3; i++) {	  Ps[1][i] = P[1][affine_select_pt[i]];	  Ps[2][i] = P[2][affine_select_pt[i]];	  Qs[1][i] = Q[1][affine_select_pt[i]];	  Qs[2][i] = Q[2][affine_select_pt[i]];	}	affine(Qs, Ps, 3, W);      }      for (i=1; i<=3; i++) {	for (j=1; j<=3; j++)	  fprintf(stdout,"%+3.1f ", W[i][j]);	fprintf(stdout,"\n");      }      matrix_inverse(W, 3, Winv);                  /* --- read file  --- */            sprintf(filename,"%s/%s", indir, infile);      if (bytes_pixel == 4)	read_RAW_float(filename, image_in, nrow, ncol);      else	read_RAW(filename, image_in, nrow, ncol);      fprintf(stdout, "Read %d-by-%d %s file %s\n",	      nrow, ncol, (bytes_pixel==4 ? "float":"uchar"), infile);      fprintf(stdout,"Affine matrix: \n");        for (i=1; i<=3; i++) {	for (j=1; j<=3; j++)	  fprintf(stdout,"%+3.3f ", W[i][j]);	fprintf(stdout,"\n");      }                /* --- apply warp to image --- */            printf("bgvalue = %f\n", bgvalue);       i = affine_warp(image_in, image_out, nrow, ncol, W, bgvalue);      fprintf(stdout,"Applied affine warp ... %d lowpass iterations\n", i);      if (bytes_pixel == 1)	for (i=1; i<=out_nrow; i++)	  for (j=1; j<=out_ncol; j++)	    image_out[i][j] = (int) image_out[i][j];      /* --- apply mask --- */      if (do_mask) {	if (bytes_pixel == 1) {	  for (i=1; i<=out_nrow; i++)	    for (j=1; j<=out_ncol; j++) 	      image_out[i][j] = (int) (image_out[i][j] * mask[i][j]);	  	}	if (bytes_pixel == 4) {	  for (i=1; i<=out_nrow; i++)	    for (j=1; j<=out_ncol; j++)	      image_out[i][j] *= mask[i][j];	}	fprintf(stdout,"Applied mask ...\n");      }            /* --- normalize contrast ---- */            if (do_contrast) {	contrast_npixels = contrast(image_out, image_in, 				    out_nrow, out_ncol,				    contrast_pedestal, contrast_scale,				    &contrast_mean, &contrast_sigma);	fprintf(stdout,		"Contrast pixels = %d\nContrast mean   = %3.2f\nContrast sigma  = %3.2f\n",		contrast_npixels, contrast_mean, contrast_sigma);	for (i=1; i<=out_nrow; i++)	  for (j=1; j<=out_ncol; j++)	   image_out[i][j] = image_in[i][j];      }      /* --- write output image --- */          if (out_float_flag == 0) {	for (i=1; i<=out_nrow; i++) 	  for (j=1; j<=out_ncol; j++)	    if (image_out[i][j]>255)	      uchar_image[i][j] = 255;	    else if (image_out[i][j]<0)	      uchar_image[i][j] = 0;	    else 	      uchar_image[i][j] = (int) (image_out[i][j] + 0.5);      }      sprintf(filename,"%s/%s", outdir, infile);      if (out_float_flag == 1)	write_RAW_float(filename, image_out, out_nrow, out_ncol);      else	write_RAW(filename, uchar_image, out_nrow, out_ncol);      fprintf(stdout,"Wrote %d-by-%d %s output file %s\n\n", 	      out_nrow, out_ncol, 	      (out_float_flag==1 ? "float":"uchar"), filename);                }  }  /* --- write output dir descriptor --- */    write_descriptor(outdir, nframe, out_ncol, out_nrow, bytes_pixel, comline);  free_matrix(P, 1, M, 1, nfeatures);  free_matrix(Q, 1, M, 1, nfeatures);  free_matrix(W, 1, 3, 1, 3);  free_matrix(Winv, 1, 3, 1, 3);  free_matrix(image_in, 1, nrow, 1, ncol);  free_matrix(image_out, 1, nrow, 1, ncol);  if (bytes_pixel == 1)    free_cmatrix(uchar_image, 1, out_nrow, 1, out_ncol);  if (do_mask == 1)    free_matrix(mask, 1, out_nrow, 1, out_ncol);  if (affine_select) {    free_matrix(Ps, 1, 2, 1, 3);    free_matrix(Qs, 1, 2, 1, 3);  }  fclose(fp);  return 0;}/* ====================================================================== */int contrast(float **image_in, float **image_out, 	      int nrow, int ncol,	      float pedestal, float scale,	      float *mean, float *sigma){  register int i,j;  float sum;  float my_mean, my_sigma;  int count;  /* --- compute statistics ---- */  sum = count = 0;  for (i=1; i<=nrow; i++)    for (j=1; j<=ncol; j++) {      if (contrast_nonzero_flag == 1) {	if (image_in[i][j] != 0) {	  sum += image_in[i][j];	  count ++;	}      }      else {	sum += image_in[i][j];	count ++;      }    }  my_mean = sum/count;  sum = count = 0;  for (i=1; i<=nrow; i++)    for (j=1; j<=ncol; j++) {      if (contrast_nonzero_flag == 1) {	if (image_in[i][j] != 0) {	  sum += SQR(image_in[i][j] - my_mean);	  count ++;	}      }      else {	sum += SQR(image_in[i][j] - my_mean);	count ++;      }    }  my_sigma = sqrt(sum/(count-1));  /* --- remap input image ---- */  for (i=1; i<=nrow; i++)    for (j=1; j<=ncol; j++)       if (contrast_nonzero_flag == 1) {	if (image_in[i][j] != 0)	  image_out[i][j] = pedestal + 	    scale * (image_in[i][j]-my_mean)/my_sigma;	else	  image_out[i][j] = 0;      }  *mean = my_mean;  *sigma = my_sigma;  return count;}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美xfplay| 国产成人av网站| 精品一区二区三区在线观看| 蜜臀91精品一区二区三区 | 欧美日韩国产大片| 欧美一区二区三区四区五区 | 黑人精品欧美一区二区蜜桃| 国产高清精品久久久久| 成人免费高清视频在线观看| 色婷婷综合久久久中文字幕| 678五月天丁香亚洲综合网| 国产午夜精品久久久久久久| 亚洲人精品一区| 蜜臀av国产精品久久久久| 99久久精品国产麻豆演员表| 欧美一区二区在线视频| 中文字幕欧美一区| 美女网站在线免费欧美精品| kk眼镜猥琐国模调教系列一区二区| 欧美二区三区91| 中文字幕一区二区三区四区| 奇米777欧美一区二区| 成人开心网精品视频| 欧美一区二区免费| 国产精品国产三级国产普通话三级| 无码av免费一区二区三区试看| 国产一区福利在线| 欧美日韩成人一区二区| 国产精品第五页| 国产综合色精品一区二区三区| 欧美性受极品xxxx喷水| 国产精品少妇自拍| 经典三级在线一区| 在线观看91av| 亚洲黄色免费电影| 成人综合婷婷国产精品久久蜜臀| 在线播放日韩导航| 亚洲乱码国产乱码精品精小说 | 国产女人18毛片水真多成人如厕| 午夜视频一区在线观看| 91美女片黄在线| 欧美激情一区在线观看| 久久9热精品视频| 欧美日韩国产大片| 亚洲综合一区二区精品导航| 91玉足脚交白嫩脚丫在线播放| 久久这里只有精品首页| 青草av.久久免费一区| 欧美三级日本三级少妇99| 亚洲视频一区二区在线| 成人国产在线观看| 国产欧美一区视频| 国产成人在线免费观看| 久久影院午夜论| 久久精品国产精品青草| 91精品国产综合久久久蜜臀图片 | 91麻豆精品91久久久久同性| 亚洲黄色片在线观看| 色就色 综合激情| 亚洲黄色av一区| 色综合久久久久综合体桃花网| 国产精品伦理一区二区| 成人中文字幕电影| 国产精品私人自拍| 成人黄色av电影| 亚洲欧美怡红院| 色综合久久久久| 亚洲欧美日韩一区二区| 色网综合在线观看| 亚洲影院久久精品| 欧美日韩一区不卡| 午夜av一区二区三区| 制服丝袜国产精品| 欧美aaaaa成人免费观看视频| 日韩一级免费观看| 久久99国产精品尤物| 久久这里都是精品| 成人短视频下载| 亚洲日本电影在线| 欧美天堂一区二区三区| 首页国产欧美日韩丝袜| 日韩三级.com| 国产美女av一区二区三区| 久久精品视频网| 97久久超碰精品国产| 一区二区三区四区五区视频在线观看 | 欧美美女bb生活片| 免费看黄色91| 久久九九全国免费| 成人激情午夜影院| 亚洲自拍与偷拍| 91精品久久久久久蜜臀| 国产麻豆日韩欧美久久| 国产精品国产自产拍高清av | 日日夜夜精品视频天天综合网| 69堂成人精品免费视频| 激情五月婷婷综合网| 中国av一区二区三区| 色婷婷亚洲一区二区三区| 午夜亚洲福利老司机| 亚洲精品一线二线三线无人区| 夫妻av一区二区| 亚洲精品欧美专区| 日韩视频一区二区三区在线播放| 国产精品一区二区三区网站| 一区在线观看视频| 欧美老女人在线| 国产精品888| 亚洲国产精品影院| 久久久激情视频| 91久久精品国产91性色tv| 日韩avvvv在线播放| 国产精品美女一区二区| 91精品国产综合久久蜜臀| 成人性生交大片免费看中文| 亚洲二区在线观看| 国产色综合久久| 欧美精品在线视频| 成人国产一区二区三区精品| 日韩精品一二三区| 中文字幕一区二区三区在线不卡| 91精品国产91热久久久做人人| 国产盗摄一区二区| 日一区二区三区| 国产精品卡一卡二卡三| 欧美一区二区三区免费观看视频| 成人av网址在线| 日本亚洲电影天堂| 亚洲欧洲日产国码二区| 精品福利视频一区二区三区| 欧美亚洲一区二区三区四区| 国产精品一区专区| 视频在线观看一区二区三区| 国产精品九色蝌蚪自拍| 精品国一区二区三区| 欧美视频一区二区三区| 国产91精品露脸国语对白| 日韩福利视频导航| 亚洲人精品午夜| 久久无码av三级| 在线电影一区二区三区| 91视频免费看| 国产电影精品久久禁18| 免费美女久久99| 午夜不卡av免费| 亚洲综合一二区| 综合久久给合久久狠狠狠97色| 26uuu国产在线精品一区二区| 欧美久久婷婷综合色| 一本色道a无线码一区v| 岛国一区二区三区| 国产精品影视天天线| 久久99国内精品| 日本成人在线视频网站| 亚洲国产精品精华液网站| 亚洲视频一区二区在线观看| 国产精品天干天干在观线| 久久亚洲一区二区三区明星换脸| 这里只有精品电影| 欧美精品99久久久**| 欧洲人成人精品| 91色porny在线视频| 大胆欧美人体老妇| 高清不卡一二三区| 国产精品 日产精品 欧美精品| 老司机一区二区| 日本欧美加勒比视频| 天涯成人国产亚洲精品一区av| 亚洲影视资源网| 亚洲一卡二卡三卡四卡五卡| 亚洲乱码国产乱码精品精98午夜 | 91高清视频免费看| 色综合中文综合网| 国产美女在线精品| 韩国v欧美v日本v亚洲v| 欧美aaa在线| 裸体歌舞表演一区二区| 日本vs亚洲vs韩国一区三区二区| 天堂成人免费av电影一区| 亚洲成人精品在线观看| 午夜不卡av在线| 免费人成在线不卡| 三级一区在线视频先锋| 免费在线一区观看| 毛片av一区二区| 国模娜娜一区二区三区| 国产成人免费视频网站高清观看视频| 久久66热偷产精品| 国产精品91一区二区| av综合在线播放| 99久久免费视频.com| 色婷婷综合在线| 在线播放视频一区| 精品少妇一区二区三区在线播放| 精品成人免费观看| 中文欧美字幕免费| 亚洲视频中文字幕| 亚瑟在线精品视频| 久久精品噜噜噜成人av农村| 国产成人精品免费|