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

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

?? canny.c

?? feret人臉圖象數據庫處理代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*----------------------------------------------------------------------PROGRAM: canny.cDATE:    11/15/94AUTHOR:  Baback Moghaddam, baback@media.mit.edu------------------------------------------------------------------------   This routine reads in an ASCII file of the format   filename     .   .   .   and applies the canny edge detector to each image in the input directory,   the resulting magnitude and thresholded images are written to the specified   output directoryies under the same names.      Canny code is from the AI-lab ---------------------------------------------------------------------- */#include <stdio.h>#include <stdlib.h>#include <string.h>#include <math.h>#include <float.h>#include "util.h"#include "io.h"#include "canny.h"  #define MAX_CHARS  256/* ----------- 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:e:m:s:h:f:n:"char *usage = "\t-i indir -l list -e edge_outdir -m mag_outdir\n\\t\t[-s sigma] [-h high_thresh] [-f thr_factor] [-n iterations]\n\n";char *help="\Canny edge-detection on a set of images\n\n\-i indir       \t input directory (containing raw files + descriptor)\n\-l listfile    \t ASCII list of files in indir to process (one per line)\n\-e edge_outdir \t output directory for binary edge images\n\-m mag_outdir  \t output directory for edge magnitude images\n\-s float       \t Canny sigma parameter            (default = 1)\n\-h float       \t Canny high threshold   (0 - 100) (default = 30)\n\-f float       \t Canny threshold factor (0 - 1)   (default = 0.1)\n\-n int         \t Canny grow iterations            (default = 30)\n\n";/*----------------------------------------------------------------------*/main(int argc, char **argv){   register int i,j,k,l,ii,jj;  int f, c, nframe, nfeatures, sets, bytes_pixel;  int nrow, ncol, M, N;  char command[MAX_CHARS],indir[MAX_CHARS],listfile[MAX_CHARS], \    infile[MAX_CHARS], filterfile[MAX_CHARS],outdir[MAX_CHARS], \      filename[MAX_CHARS], line[MAX_CHARS], line_outdir[MAX_CHARS],      mag_outdir[MAX_CHARS];  float **image_in, **image_out;  unsigned char **uchar_image;  float fval1, fval2, fval;  FILE *fp, *fp2;         /* for output values dump */  /* ---- Canny stuff ---- */  float h_threshold;  int bytes;  int vert_size, horiz_size;  float **picture, **xdirection, **ydirection, **hgrm_working_space;  char *im, **edges, **w1space, **w2space;  /* required input flags */  int errflag   = 0;  int inflag    = 0;  int listflag  = 0;  int outflag   = 0;  /* command line defaults */  int line_outdir_select = 0;  int mag_outdir_select  = 0;  /* This is the default for smoothing (must be > 0) */  float sigma = CANNY_SIGMA_DEF;  /* This is the default for 'growing' (must be >= 0) */  int passes = CANNY_PASSES_DEF;  /* This is the default for thresholding (must be 0 < hp < 100) */  float h_percent = CANNY_H_PERC_DEF;  /* This is the default for thresholding (must be 0 < tf < 1 */  float thr_factor = CANNY_THR_FACTOR;  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 'e':      strcpy(line_outdir, optarg);      line_outdir_select = outflag = 1;      break;    case 'm':      strcpy(mag_outdir, optarg);      mag_outdir_select = outflag = 1;      break;    case 's':      sigma = atof(optarg);      break;    case 'h':      h_percent = atof(optarg);      break;    case 'f':      thr_factor = atof(optarg);      break;        case 'n':      passes = atoi(optarg);      break;    case '?':      errflag = 1;      break;    }    /* command line error check */    if (errflag || !inflag || !outflag || !listflag) {    fprintf(stderr,"\nUSAGE: %s %s\n%s\n", progname, usage, help);    /*print_documentation(sigma, h_percent, thr_factor, passes);*/    exit(-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 (bytes_pixel>1)     myerror("Input files must be unsigned char!");  vert_size  = nrow;  horiz_size = ncol;    /* ---- allocate memory for Canny code data ------*/  picture = (float **) matrix(0, vert_size-1, 0, horiz_size-1);  xdirection = (float **) matrix(0, vert_size-1, 0, horiz_size-1);  ydirection = (float **) matrix(0, vert_size-1, 0, horiz_size-1);  hgrm_working_space = (float **) matrix(0, vert_size-1, 0, horiz_size-1);  edges = scmatrix(0, vert_size-1, 0, horiz_size-1);  w1space = scmatrix(0, vert_size-1, 0, horiz_size-1);  w2space = scmatrix(0, vert_size-1, 0, horiz_size-1);    /* ----- allocate memory for my stuff ------- */  image_in   = matrix(1, nrow, 1, ncol);  image_out  = matrix(1, nrow, 1, ncol);  uchar_image = cmatrix(1, nrow, 1, ncol);  /* ---- 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 (fgets(line, MAX_CHARS, fp)) {    if (strncmp(line, "#", 1) != 0 && strlen(line)>1) {      nframe++;            /* ------- read image ------- */             sscanf(line,"%s",infile);        sprintf(filename,"%s/%s", indir, infile);      read_RAW(filename, image_in, nrow, ncol);      fprintf(stdout,"Read  %d-by-%d uchar input image file %s\n",	      nrow, ncol, filename);       convert_1f_to_0f(image_in, picture, vert_size, horiz_size);     	      /* gsmooth smooths an array with a gaussian filter */            gsmooth(picture, sigma, vert_size, horiz_size);            /* gradmax takes the smoothed picture and replaces it	 with the gradient magnitude (a mutation). It also	 returns the x and y derivatives, and it returns the 	 map of local maximums. */            gradmax(picture, xdirection, ydirection, edges, vert_size, horiz_size);            /* find_thres takes the x derivative and y derivative	 arrays, a histogram percentile value, and an array	 (as working space) to estimate the high threshold	 for thresholding */            h_threshold = find_thres(xdirection, ydirection, h_percent,			       hgrm_working_space,vert_size, horiz_size);            /* threshold takes arguments: gradient magnitude array,	 map of local maximums, a value for high threshold,	 the number of passes for 'growing', and two arrays	 for work space. It returns the final edge map in	 the array of local maximums (a mutation). */            threshold(picture, edges, h_threshold, thr_factor, passes,		w1space, w2space, vert_size, horiz_size);            /* write edge map and magnitude of gradient at edges */        if (line_outdir_select) {	convert_0c_to_1uc(edges, uchar_image, vert_size, horiz_size);	sprintf(filename,"%s/%s", line_outdir, infile);	write_RAW(filename, uchar_image, vert_size, horiz_size);	fprintf(stdout,"Wrote %d-by-%d binary edge output file %s\n", 		nrow, ncol, filename);      }      if (mag_outdir_select) {	magedges(picture, edges, vert_size, horiz_size);	convert_0f_to_1uc(picture, uchar_image, vert_size, horiz_size);	sprintf(filename,"%s/%s", mag_outdir, infile);	write_RAW(filename, uchar_image, vert_size, horiz_size);	fprintf(stdout,"Wrote %d-by-%d edge-magnitude output file %s\n", 		nrow, ncol, filename);      }            fprintf(stdout,"\n");    }  }   /* --- write output descriptor file in outdir ------ */  if (line_outdir_select)      write_descriptor(line_outdir, nframe, ncol, nrow, 1, comline);  if (mag_outdir_select)      write_descriptor(mag_outdir, nframe, ncol, nrow, 1, comline);  fclose(fp);   /* ---- free Canny memory ---- */  free_matrix(picture, 0, vert_size-1, 0, horiz_size-1);  free_matrix(xdirection, 0, vert_size-1, 0, horiz_size-1);  free_matrix(ydirection, 0, vert_size-1, 0, horiz_size-1);  free_matrix(hgrm_working_space, 0, vert_size-1, 0, horiz_size-1);  free_scmatrix(edges, 0, vert_size-1, 0, horiz_size-1);  free_scmatrix(w1space, 0, vert_size-1, 0, horiz_size-1);  free_scmatrix(w2space, 0, vert_size-1, 0, horiz_size-1);  /* --- free my stuff ---- */  free_matrix(image_in, 1, nrow, 1, ncol);  free_matrix(image_out, 1, nrow, 1, ncol);  free_cmatrix(uchar_image, 1, nrow, 1, ncol);  return 0;}/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */void convert_1f_to_0f(float **in, float **out, int nrow, int ncol)/* copies in[1..nrow][1..ncol] to out[0...(nrow-1)][0..(ncol-1)] */{  register int i,j;  for (i=1; i<=nrow; i++)    for (j=1; j<=ncol; j++)      out[i-1][j-1] = in[i][j];}void convert_0c_to_1uc(char **in, unsigned char **out,		      int nrow, int ncol)/* copies in[0...(nrow-1)][0..(ncol-1)] to out[1..nrow][1..ncol] */{  register int i,j;  for (i=0; i<nrow; i++)    for (j=0; j<ncol; j++)      out[i+1][j+1] = in[i][j];}void convert_0f_to_1uc(float **in, unsigned char **out,		      int nrow, int ncol)/* copies in[0...(nrow-1)][0..(ncol-1)] to out[1..nrow][1..ncol] */{  register int i,j;  for (i=0; i<nrow; i++)    for (j=0; j<ncol; j++)      out[i+1][j+1] = (unsigned char) in[i][j];}/*===========================================================================*/void print_documentation(float s, float h, float l, int i){  char *message = "\Canedge is a simplified version of an edge detector developed by \\nJohn Canny at MIT's Artificial Intelligence laboratory. The detector\\nfirst smooths an image using a gaussian shaped low pass filter. \\nThen the gradient magnitude of the smoothed image is non-maximum\\nsuppressed in the direction of the gradient.  These maxima are then\\nthresholded at a high threshold, and again at a low threshold (which\\nis some fraction of the high threshold).  Every maxima above the\\nhigh threshold is an edge.  The next step is called edge 'growing'.\\nEvery point above the low threshold (but not above the high threshold)\\nis marked as an edge if it is next to a point above the high threshold.\\nThis process is repeated several times and thus, the edges are\\n'grown'.\n";  printf("\nusage: canedge [-s float] [-h float] [-l float] [-i int] in_im line_im mag_im\n\n");  printf("-s float : smoothing sigma\n");  printf("           Default: %f\n",s);  printf("-h float : high threshold\n");  printf("           Default: %f\n",h);  printf("-l float : low threshold\n");  printf("           Default: %f\n",l);  printf("-i int   : growing iterations\n");  printf("           Default: %d\n",i);    printf("\n%s\n",message);}/*===========================================================================*/void parse_options(int argc, char *argv[], 		   float *s, float *h, float *l, int *i, 		   char *indir, char *line_outdir, char *mag_outdir){  int errflag = 0;  int fileloc = 0;  char c; while ((c = getopt(argc, argv, OPTIONS)) != EOF)   switch (c) {   case 's':      *s = atof(optarg);      fileloc += 2;      break;    case 'l':      *l = atof(optarg);      fileloc += 2;      break;    case 'i':      *i = atoi(optarg);      fileloc += 2;      break;    case '?':      errflag = 1;      break;    }  if (argc != fileloc + 4) {    print_documentation(*s, *h, *l, *i);    exit(-1); }    fprintf(stderr,"%d s %s \n", fileloc, argv[fileloc+1]);  strcpy(indir, argv[fileloc+1]);  strcpy(line_outdir, argv[fileloc+2]);  strcpy(mag_outdir, argv[fileloc+3]);}/*===========================================================================*//* These functions are part of my first version of a float gaussian   smoother.  The include file sizes.h contains size information. */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一区二区三区在线电影| gogo大胆日本视频一区| 一区二区成人在线视频| 欧美激情中文字幕一区二区| 亚洲精品一区二区三区在线观看| 欧美精品第1页| 777久久久精品| 777午夜精品免费视频| 欧美一区二区三区四区久久| 91精品国产综合久久精品app| 欧美三级日韩三级| 欧美精品日韩一本| 日韩一区二区电影网| 日韩精品一区二区三区中文精品| 欧美一区二区三区系列电影| 欧美一区二区三区日韩视频| 日韩欧美中文一区二区| 久久久久久日产精品| 国产欧美综合色| 国产精品福利在线播放| 亚洲欧美区自拍先锋| 夜夜嗨av一区二区三区网页 | 国产精品久久久久久亚洲伦 | 亚洲一级电影视频| 亚洲成在线观看| 美女一区二区视频| 韩国女主播一区| 东方aⅴ免费观看久久av| aaa亚洲精品| 欧美日精品一区视频| 91麻豆精品国产91久久久久久久久| 欧美一区二区三区在线电影| 久久精品亚洲精品国产欧美kt∨| 精品国产乱码久久久久久闺蜜| 国产视频一区二区三区在线观看| 日韩理论电影院| 天天色综合成人网| 精品一区二区国语对白| 岛国一区二区三区| 欧美亚洲愉拍一区二区| 精品国产成人在线影院| 国产精品久久久久久久久免费樱桃| 国产精品久久久久久久久动漫| 国产精品久久久久久久蜜臀 | 成人天堂资源www在线| 91黄视频在线| 欧美老肥妇做.爰bbww| 久久久亚洲综合| 一区二区成人在线视频| 黄一区二区三区| 99久久久免费精品国产一区二区| 欧美日韩一区二区在线观看| 久久久久久久久97黄色工厂| 亚洲在线视频网站| 国产很黄免费观看久久| 欧美日韩视频在线一区二区| 国产日韩欧美综合一区| 亚洲成人免费视频| 国产风韵犹存在线视精品| 欧美伊人精品成人久久综合97| 久久综合九色综合97婷婷女人 | 亚洲黄色尤物视频| 免费一级欧美片在线观看| 不卡电影一区二区三区| 4438成人网| 综合激情成人伊人| 国内精品视频一区二区三区八戒| av午夜一区麻豆| 精品国精品国产| 亚洲一区二区四区蜜桃| 国产成人精品免费| 制服丝袜成人动漫| 亚洲天堂2016| 国产高清亚洲一区| 日韩欧美一区在线| 五月天亚洲婷婷| 99麻豆久久久国产精品免费| 26uuu国产一区二区三区| 亚洲h在线观看| 99精品在线观看视频| 久久亚区不卡日本| 六月丁香综合在线视频| 欧美日韩精品福利| 亚洲另类中文字| av在线不卡电影| 久久精品人人做人人综合 | 亚洲最大色网站| 韩国欧美国产1区| 欧美一级片在线| 亚瑟在线精品视频| 在线免费观看日韩欧美| 亚洲人一二三区| 99亚偷拍自图区亚洲| 国产日韩精品视频一区| 韩国欧美国产1区| 久久婷婷综合激情| 久久99精品久久久久久| 91精品欧美福利在线观看| 亚洲国产中文字幕| 精品视频一区二区不卡| 一区二区免费看| 欧洲视频一区二区| 亚洲成人精品一区| 欧美做爰猛烈大尺度电影无法无天| 亚洲色图视频网| 色老头久久综合| 亚洲国产一区二区三区| 欧美性videosxxxxx| 亚洲地区一二三色| 91麻豆精品国产无毒不卡在线观看| 日韩二区三区四区| 91精品国产综合久久福利| 蜜臀av亚洲一区中文字幕| 日韩一级欧美一级| 国产在线看一区| 国产日产亚洲精品系列| 成人av电影在线网| 亚洲欧美日韩一区二区| 欧美性猛交xxxx黑人交 | 色综合久久综合网欧美综合网| 亚洲色图视频网| 欧美精选在线播放| 久久66热偷产精品| 国产午夜一区二区三区| av在线不卡免费看| 亚洲v中文字幕| 欧美xxxxxxxx| 国产麻豆一精品一av一免费| 国产欧美一区二区在线| 99re热这里只有精品免费视频| 一区二区三区四区精品在线视频| 欧美日韩国产免费一区二区| 久久99久久精品| 国产视频一区在线观看| 色噜噜狠狠色综合中国| 日韩国产在线一| 久久久www成人免费毛片麻豆| 亚洲国产aⅴ天堂久久| 丁香激情综合国产| 欧美精品一区二区三| 国产精品毛片久久久久久| 在线精品亚洲一区二区不卡| 午夜精品福利在线| 久久久无码精品亚洲日韩按摩| 成年人国产精品| 亚洲18女电影在线观看| 欧美不卡一区二区三区四区| 成人午夜在线播放| 午夜精品一区二区三区电影天堂 | 日韩一区二区影院| 国产凹凸在线观看一区二区| 亚洲永久精品国产| 26uuu国产一区二区三区| 在线日韩一区二区| 激情综合亚洲精品| 亚洲一区二三区| 久久久久久日产精品| 欧美日韩一二三区| 高清不卡一区二区| 性欧美疯狂xxxxbbbb| 中文字幕不卡一区| 91麻豆精品国产自产在线观看一区 | 午夜精品在线视频一区| 国产女同互慰高潮91漫画| 欧美性受极品xxxx喷水| 国产成人精品亚洲日本在线桃色 | 色狠狠色狠狠综合| 国产电影一区在线| 美美哒免费高清在线观看视频一区二区 | 成人欧美一区二区三区1314| 欧美一区午夜视频在线观看| 99久久精品免费观看| 国产一区中文字幕| 日日夜夜精品免费视频| 亚洲人成网站在线| 国产亚洲污的网站| 亚洲1区2区3区4区| 亚洲日本免费电影| 久久久精品天堂| 91精品国产色综合久久| 在线看国产一区二区| jizzjizzjizz欧美| 成人一区二区三区在线观看| 久久精品国产亚洲a| 亚洲成国产人片在线观看| ...av二区三区久久精品| 久久久国产一区二区三区四区小说| 91精品国产综合久久香蕉的特点 | 91精品国产91综合久久蜜臀| 欧美天堂一区二区三区| 日韩欧美国产一区二区在线播放| 色先锋aa成人| 成人夜色视频网站在线观看| 麻豆精品视频在线| 日韩av一二三| 亚洲高清三级视频| 亚洲欧洲性图库| 国产精品久久久久婷婷二区次| 国产欧美一区视频| 欧美国产国产综合|