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

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

?? findblob.c

?? NIST Handwriting OCR Testbed
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*# proc: findblob - finds a 4-connected blob of true pixels from within a# proc:            binary character image, returning the blob as a character# proc:            image.# proc: findblob8 - finds an 8-connected blob of true pixels from within a# proc:            binary character image, returning the blob as a character# proc:            image.# proc: findblobnruns - finds a 4-connected blob of true pixels from within a# proc:            binary character image, returning the blob as a character# proc:            image and the horizontal runs comprising the blob.# proc: findblobnruns8 - finds an 8-connected blob of true pixels from within a# proc:            binary character image, returning the blob as a character# proc:            image and the horizontal runs comprising the blob.# proc: findbinblob - finds a connected blob of true pixels from within a# proc:               binary character image, returning the blob as a binary# proc:               bitmap.# proc: findblob_stats_rw - finds a blob of true pixels in a binary char image# proc:                     (search row maj) and returns the blob "stats"# proc: findblob_stats_cl - finds a blob of true pixels in a binary char image# proc:                     (search col maj) and returns the blob "stats"# proc: end_findblobs - deallocates memory upon completion of a findblob session.# proc:*/#include <stdio.h>#include <findblob.h>/************************************************************/findbinblob(ras, w, h, erase_flag, out_flag, start_x, start_y,            binras, bin_w, bin_h, box_x, box_y, box_w, box_h)unsigned char *ras, **binras;int w, h, erase_flag, out_flag;int *start_x, *start_y, *bin_w, *bin_h, *box_x, *box_y, *box_w, *box_h;{   int ret, tw, th;   unsigned char *charras;   /* if W_H_BLOB, must save box w & h inputs before they are overwritten */   tw = *box_w;   th = *box_h;   ret = findblob(ras, w, h, erase_flag, ALLOC, out_flag,                  start_x, start_y, &charras, box_x, box_y, box_w, box_h);   switch (ret){      case 1:         switch (out_flag){	    case ORIG_BLOB:               char2bin_exact(binras, bin_w, bin_h, charras, w, h);               break;	    case W_H_BLOB:               char2bin_exact(binras, bin_w, bin_h, charras, tw, th);               break;	    case BOUND_BLOB:               char2bin_exact(binras, bin_w, bin_h, charras, *box_w, *box_h);               break;	    default:               fatalerr("findbinblob", "unknown out_flag value", NULL);         }         free(charras);         break;      case 2:         char2bin_exact(binras, bin_w, bin_h, charras, *box_w, *box_h);         free(charras);         break;      default:         break;   }   return(ret);}/************************************************************//*         Routine:   findblob()                            *//*         Author:    G. T. Candela                         *//*         Date:      3/1/94                                *//*                                                          *//*         Modifications:                                   *//*           5/2/94 - faster version: uses runs             *//************************************************************//* Each time findblob is called, it either returns one blob of thetrue pixels of a binary raster, or indicates that it encountered noblobs in its col-major scan from the desired starting position to thebottom-right corner of the raster.  Parameters are:  ras: Input binary raster, represented using one byte per pixel.  w: Width of ras.  h: Height of ras.  erase_flag: Can be ERASE or NO_ERASE:    ERASE     findblob erases blobs from input as it finds them.    NO_ERASE  Doesn't erase blobs.  CAUTION: If findblob is called     multiple times for a raster with NO_ERASE and caller does not     erase blobs from input raster after they are returned, findblob     will repeatedly find the same blob, unless caller changes     (start_x, start_y) between calls.  alloc_flag: Can be ALLOC or NO_ALLOC:    ALLOC     findblob will allocate output blob-rasters.    NO_ALLOC  findblob won't allocate rasters: caller must.  out_flag: Can be ORIG_BLOB, W_H_BLOB, or BOUND_BLOB:    ORIG_BLOB   Each blob is returned in an otherwise empty raster the      same shape as the input raster, and its location in this output      raster is the same as its location in the input raster.    W_H_BLOB    Each blob is returned centered in a raster of width      and height specified by box_w and box_h; but if ALLOC is      is used and width or height of blob is larger than      desired width or height, findblob allocates a raster just big      enough to hold the blob, and its returned function value warns      of this situation (return value 2).  If NO_ALLOC is used and      blob doesn't fit, that is a fatal error.    BOUND_BLOB  Each blob is returned in a raster just big enough to      contain it.  This option cannot be used with NO_ALLOC.  start_x, start_y: Addresses of the x- and y-coordinates of    the pixel at which caller wants findblob to start -- or resume --    its column-major scan for blobs.  (To find all blobs,    caller can use a loop that initializes *start_x and    *start_y to zeros and does not change them thereafter, and then    should stop looping when findblob returns 0, which indicates    that the previous call had returned the last blob; if raster has    no blobs, first call of findblob will return 0.  But caller also    has the options of starting *start_x and *start_y at    something other than (0,0), and changing them between calls of    findblob.)  blobras: Address of the raster in which findblob returns the blob    it found, representing it in one byte per pixel.  box_x, box_y: Addresses of the coordinates of the top-left corner    of the bounding box of the blob that was found; the coordinates    are with respect to the input raster.  box_w, box_h: Upon return, these always contain the width and    height of the bounding box of the blob that was found; these    may or may not be the width and height of the output raster.    And if out_flag is W_H_BLOB, then box_w and    box_h are used as INPUTS as well as outputs.  To summarize:      If out_flag is ORIG_BLOB, then box_w and box_h are outputs        only, indicating the dimensions of the bounding box of the        blob, and the output raster containing the blob has the same        dimensions as the input raster.      If out_flag is W_H_BLOB, then box_w and box_h are both INPUTS        specifying the desired width and height of the output raster        in which the bounding box of the blob is to be centered (if        it fits), and OUTPUTS indicating the dimensions of the        bounding box.  (Therefore, a program that uses findblob to        find multiple blobs with W_H_BLOB and always the same specified        output raster dimensions, must reset these parms before each        call, since findblob will change them.)  If the bounding box        of the blob doesn't fit into the desired shape of output        raster, then if alloc_flag is NO_ALLOC this is a fatal error,        but if alloc_flag is ALLOC then findblob allocates an output        raster of the same shape as the blob's bounding box and        returns the blob in this raster.      If out_flag is BOUND_BLOB, then box_w and box_h are outputs        only, indicating the dimensions of the bounding box of the        blob, which are also the dimensions of the output raster:        findblob allocates the output raster just big enough        to contain the blob.  (BOUND_BLOB cannot be used with        NO_ALLOC.)The possible function values returned by findblob are:     0: It reached the bottom-right pixel without finding a blob.     1: It found a blob, and is returning it in desired format.     2: It found a blob, but ALLOC and W_H_BLOB are in effect and          blob doesn't fit into a raster of specified shape; so, it          has allocated a raster just big enough for the blob and is          returning the blob in this raster (as if BOUND_BLOB had          been used).*********************************************************************/static RUN *list = (RUN *)NULL, *list_off, *list_h, *list_t;static unsigned char *rasity;static unsigned short ww, hh, hh_m1, nlim, slim, elim, wlim;int findblob(ras, w, h, erase_flag, alloc_flag, out_flag, start_x,             start_y, blobras, box_x, box_y, box_w, box_h)unsigned char *ras, **blobras;int w, h, erase_flag, alloc_flag, out_flag,    *start_x, *start_y, *box_x, *box_y, *box_w, *box_h;{RUN *oruns, *oruns_t, *oruns_off;return findblob_connect(ras, w, h, erase_flag, alloc_flag, out_flag, start_x,                             start_y, blobras, box_x, box_y, box_w, box_h,                             &oruns, &oruns_t, &oruns_off, CONNECT4);}int findblob8(ras, w, h, erase_flag, alloc_flag, out_flag, start_x,              start_y, blobras, box_x, box_y, box_w, box_h)unsigned char *ras, **blobras;int w, h, erase_flag, alloc_flag, out_flag,    *start_x, *start_y, *box_x, *box_y, *box_w, *box_h;{RUN *oruns, *oruns_t, *oruns_off;return findblob_connect(ras, w, h, erase_flag, alloc_flag, out_flag, start_x,                             start_y, blobras, box_x, box_y, box_w, box_h,                             &oruns, &oruns_t, &oruns_off, CONNECT8);}/*********************************************************************/int findblobnruns(ras, w, h, erase_flag, alloc_flag, out_flag, start_x,             start_y, blobras, box_x, box_y, box_w, box_h, oruns, oruns_t, oruns_off)unsigned char *ras, **blobras;int w, h, erase_flag, alloc_flag, out_flag,    *start_x, *start_y, *box_x, *box_y, *box_w, *box_h;RUN **oruns, **oruns_t, **oruns_off;{return findblob_connect(ras, w, h, erase_flag, alloc_flag, out_flag, start_x,                             start_y, blobras, box_x, box_y, box_w, box_h,                             oruns, oruns_t, oruns_off, CONNECT4);}/*********************************************************************/int findblobnruns8(ras, w, h, erase_flag, alloc_flag, out_flag, start_x,              start_y, blobras, box_x, box_y, box_w, box_h, oruns, oruns_t, oruns_off)unsigned char *ras, **blobras;int w, h, erase_flag, alloc_flag, out_flag,    *start_x, *start_y, *box_x, *box_y, *box_w, *box_h;RUN **oruns, **oruns_t, **oruns_off;{return findblob_connect(ras, w, h, erase_flag, alloc_flag, out_flag, start_x,                        start_y, blobras, box_x, box_y, box_w, box_h,                        oruns, oruns_t, oruns_off, CONNECT8);}/*********************************************************************/int findblob_connect(ras, w, h, erase_flag, alloc_flag, out_flag, start_x,  start_y, blobras, box_x, box_y, box_w, box_h, oruns, oruns_t, oruns_off, connectivity)unsigned char *ras, **blobras;int w, h, erase_flag, alloc_flag, out_flag, connectivity,    *start_x, *start_y, *box_x, *box_y, *box_w, *box_h;RUN **oruns, **oruns_t, **oruns_off;{  RUN *runp;  unsigned char *p, *ps, *q, *blobrasity;  unsigned short x, y;  int offset, inner_bw, inner_bh, outer_bw, outer_bh, inner_wlim,    inner_nlim;  if(list == (RUN *)NULL) {    if(!(list = (RUN *)malloc(LIST_STARTSIZE * sizeof(RUN))))      syserr("findblobnruns_malloc_list", "malloc", "list");    list_off = list + LIST_STARTSIZE;  }  rasity = ras;  ww = w;  hh_m1 = (hh = h) - 1;  if(*start_x < 0 || *start_x >= (int)ww ||     *start_y < 0 || *start_y >= (int)hh)    fatalerr("findblobnruns", "scan start position is off raster",      "start_x, start_y");  x = *start_x;  y = *start_y;  /* Col-majorly scan for a seed pixel. */  for(p = ras + y * ww + x, ps = ras + hh_m1 * ww + x; !*p;) {    if(p < ps)      p += ww;    else {      if(++x == ww)	return 0;      p = ras + x;      ps++;    }  }  y = (p - ras) / (int)ww;  /* Grow seed pixel to a seed run. */  findblob_seed_to_run(y, p);  /* Use a queue to grow seed run into a complete blob.  Queue starts  as just the seed run; read run from queue head, produce connecting  runs (if any) and put them on queue tail, read another run from  head, etc., until queue becomes empty.  List space is not recycled:  when growth of blob is finished, list contains all runs that were  ever in the queue. */  if (connectivity == CONNECT4)     for(list_t = (list_h = list) + 1; list_h < list_t; list_h++)     {       findblob_grow_n();       findblob_grow_s();     }  else  if (connectivity == CONNECT8)     for(list_t = (list_h = list) + 1; list_h < list_t; list_h++)     {       findblob_8grow_n();       findblob_8grow_s();     }  else     fatalerr("findblobnruns", "connectivity flag", "must be CONNECT4 or CONNECT8");  /* Growth of blob is finished.  Go through list to find what pixels  to set in output raster. */  *start_x = x;  *start_y = y;  *box_x = wlim;  *box_y = nlim;  *oruns = list;  *oruns_t = list_t;  *oruns_off = list_off;  inner_bw = elim - wlim + 1;  inner_bh = slim - nlim + 1;  if(out_flag == ORIG_BLOB) {    if(alloc_flag == ALLOC) {      if(!(*blobras = (unsigned char *)calloc(ww * hh, 1)))	syserr("findblobnruns", "calloc", "blobras");    }    else if(alloc_flag == NO_ALLOC)      memset(*blobras, NULL, ww * hh);    else      fatalerr("findblobnruns", "illegal value for alloc_flag", NULL);    offset = *blobras - ras;    if(erase_flag == ERASE)      for(runp = list; runp < list_t; runp++)	for(ps = (p = runp->w_on + offset) + (runp->e_off -          runp->w_on); p < ps; p++)	  *p = 1;    else if(erase_flag == NO_ERASE)      for(runp = list; runp < list_t; runp++)	for(ps = (p = (q = runp->w_on) + offset) + (runp->e_off -          runp->w_on); p < ps; p++, q++)	  *p = *q = 1;    else      fatalerr("findblobnruns", "illegal value for erase_flag", NULL);    *box_w = inner_bw;    *box_h = inner_bh;    return 1;  }  else if(out_flag == W_H_BLOB) {    outer_bw = *box_w;    outer_bh = *box_h;    if(inner_bw <= outer_bw && inner_bh <= outer_bh) {      /* Blob's bounding box fits into a raster of the shape caller      has specified in box_w and box_h; center the bounding box in      such a raster. */      if(alloc_flag == ALLOC) {	if(!(*blobras = (unsigned char *)calloc(outer_bw * outer_bh,          1)))	  syserr("findblobnruns", "calloc", "blobras");      }      else if(alloc_flag == NO_ALLOC)	memset(*blobras, NULL, outer_bw * outer_bh);      else	fatalerr("findblobnruns", "illegal value for alloc_flag", NULL);      inner_wlim = (outer_bw - inner_bw) / 2;      inner_nlim = (outer_bh - inner_bh) / 2;      blobrasity = *blobras;      if(erase_flag == ERASE)	for(runp = list; runp < list_t; runp++)	  for(ps = (p = blobrasity + (runp->y - nlim + inner_nlim) *            outer_bw + (runp->w_on - ras) % (int)ww - wlim + inner_wlim) +            (runp->e_off - runp->w_on); p < ps; p++)	    *p = 1;      else if(erase_flag == NO_ERASE)	for(runp = list; runp < list_t; runp++)	  for(ps = (p = blobrasity + (runp->y - nlim + inner_nlim) *            outer_bw + ((q = runp->w_on) - ras) % (int)ww - wlim +            inner_wlim) + (runp->e_off - runp->w_on); p < ps; p++, q++)	    *p = *q = 1;      else	fatalerr("findblobnruns", "illegal value for erase_flag", NULL);      *box_w = inner_bw;      *box_h = inner_bh;      return 1;    }    else {      /* Blob's bounding box doesn't fit into a raster of the shape      caller has specified in box_w and box_h. */      if(alloc_flag == ALLOC) {	/* Allocate a raster of same shape as bounding box (as        for BOUND_BLOB), and return function value 2, warning        that a larger-than-specified raster was allocated. */	if(!(*blobras = (unsigned char *)calloc(inner_bw * inner_bh,          1)))	  syserr("findblobnruns", "calloc", "blobras");	blobrasity = *blobras;	if(erase_flag == ERASE)	  for(runp = list; runp < list_t; runp++)	    for(ps = (p = blobrasity + (runp->y - nlim) * inner_bw +              (runp->w_on - ras) % (int)ww - wlim) +  (runp->e_off -              runp->w_on); p < ps; p++)	      *p = 1;	else if(erase_flag == NO_ERASE)	  for(runp = list; runp < list_t; runp++)	    for(ps = (p = blobrasity + (runp->y - nlim) * inner_bw +              ((q = runp->w_on) - ras) % (int)ww - wlim) +  (runp->e_off -              runp->w_on); p < ps; p++, q++)	      *p = *q = 1;	else	  fatalerr("findblobnruns", "illegal value for erase_flag", NULL);	*box_w = inner_bw;	*box_h = inner_bh;	return 2;      }      else if(alloc_flag == NO_ALLOC)	fatalerr("findblobnruns", "Used NO_ALLOC and W_H_BLOB, and blob's \bounding box doesn't fit into specified output raster shape", NULL);      else	fatalerr("findblobnruns", "illegal value for alloc_flag", NULL);    }  }  else if(out_flag == BOUND_BLOB) {    if(alloc_flag == ALLOC) {      if(!(*blobras = (unsigned char *)calloc(inner_bw * inner_bh, 1)))	syserr("findblobnruns", "calloc", "blobras");    }    else if(alloc_flag == NO_ALLOC)      fatalerr("findblobnruns", "NO_ALLOC and BOUND_BLOB used together",        NULL);    else      fatalerr("findblobnruns", "illegal value for alloc_flag", NULL);    blobrasity = *blobras;    if(erase_flag == ERASE)      for(runp = list; runp < list_t; runp++)        for(ps = (p = blobrasity + (runp->y - nlim) * inner_bw +          (runp->w_on - ras) % (int)ww - wlim) + (runp->e_off -          runp->w_on); p < ps; p++)	  *p = 1;    else if(erase_flag == NO_ERASE)      for(runp = list; runp < list_t; runp++)        for(ps = (p = blobrasity + (runp->y - nlim) * inner_bw +          ((q = runp->w_on) - ras) % (int)ww - wlim) + (runp->e_off -          runp->w_on); p < ps; p++, q++)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
1区2区3区精品视频| 欧美久久一区二区| 国产人久久人人人人爽| 国产一区二区中文字幕| 精品国产伦理网| 国产精品一区二区三区乱码| 中文一区二区完整视频在线观看 | 欧美日韩五月天| 亚洲电影一级片| 欧美一级片在线看| 国产一区二区三区免费播放| 欧美国产激情二区三区| 色综合天天综合狠狠| 亚洲电影中文字幕在线观看| 欧美一区二区视频观看视频| 国产美女精品一区二区三区| 国产精品不卡一区二区三区| 在线免费av一区| 美女视频黄 久久| 国产精品乱人伦一区二区| 欧美专区亚洲专区| 久久国产精品无码网站| 国产精品传媒视频| 欧美精品123区| 国产精品77777竹菊影视小说| 中文字幕一区二区三区视频| 欧美区一区二区三区| 国产精品亚洲一区二区三区在线| 一色桃子久久精品亚洲| 91精品国产入口| 成人国产亚洲欧美成人综合网| 亚洲国产wwwccc36天堂| 久久这里只有精品首页| 在线这里只有精品| 国产在线不卡一卡二卡三卡四卡| 一区二区三区自拍| 精品99一区二区| 欧美日韩一区二区三区不卡| 国产精品一卡二| 五月激情综合色| 亚洲私人黄色宅男| 久久久久久久久久久电影| 欧美日韩一卡二卡三卡| av网站免费线看精品| 久久91精品久久久久久秒播| 一区二区三区四区在线免费观看| 精品国产成人系列| 欧美高清一级片在线| 91亚洲国产成人精品一区二区三| 久久不见久久见免费视频7| 亚洲一区自拍偷拍| 日本一区二区三级电影在线观看| 欧美一区二区网站| 欧美伊人久久久久久久久影院| 国产麻豆精品视频| 蜜桃一区二区三区在线| 亚洲va欧美va人人爽| 亚洲视频网在线直播| 亚洲成人三级小说| 亚洲色图欧美激情| 国产精品久久久久久久久快鸭| 精品国产91乱码一区二区三区| 欧美精品一二三区| 欧美午夜一区二区三区 | 亚洲女与黑人做爰| 国产亚洲欧美日韩在线一区| 制服丝袜中文字幕一区| 欧美无乱码久久久免费午夜一区| aa级大片欧美| 99视频超级精品| 成人动漫一区二区三区| 成人综合日日夜夜| 国产aⅴ综合色| 国产91富婆露脸刺激对白| 国产精品99久| 丰满亚洲少妇av| 成人精品一区二区三区四区 | 成人精品亚洲人成在线| 成人精品国产免费网站| 成人午夜视频在线| 国产91综合一区在线观看| 国产成人免费视频| 国产福利精品一区| 成人av在线影院| 91影视在线播放| 91视视频在线观看入口直接观看www| av一区二区三区在线| 99国产精品国产精品毛片| 91蝌蚪porny| 欧洲av在线精品| 欧美日韩一区视频| 精品日韩在线一区| 久久精品无码一区二区三区| 亚洲国产精品黑人久久久| 亚洲欧美日韩国产综合| 亚洲一区二区在线免费观看视频| 日韩不卡一区二区三区| 激情图区综合网| av在线不卡免费看| 欧美三级在线播放| 欧美成人猛片aaaaaaa| 国产婷婷一区二区| 伊人夜夜躁av伊人久久| 亚洲成a人在线观看| 久久国产精品免费| 成人av电影在线网| 欧美性做爰猛烈叫床潮| 2023国产精品| 一区二区三区鲁丝不卡| 美女网站在线免费欧美精品| 成人性色生活片| 欧美日韩高清在线| 国产日本亚洲高清| 亚洲国产另类av| 国产高清成人在线| 在线成人av网站| 国产女人aaa级久久久级| 一二三四区精品视频| 精品在线一区二区| 色天天综合色天天久久| 欧美精品第1页| 亚洲婷婷综合久久一本伊一区| 日本视频中文字幕一区二区三区| 成人午夜视频在线观看| 91精品国产91久久久久久一区二区 | 亚洲综合一区二区精品导航| 午夜激情久久久| 国产91精品精华液一区二区三区| 91蜜桃网址入口| 日韩免费性生活视频播放| 亚洲少妇中出一区| 国产精品99精品久久免费| 欧美精品高清视频| 一区二区三区久久久| 成人黄色电影在线| 欧美成人官网二区| 亚洲成人激情自拍| 91丨porny丨户外露出| 久久久久久一二三区| 青青草91视频| 欧美日韩一卡二卡三卡| 日韩美女视频19| 处破女av一区二区| 久久综合久久综合久久| 天天综合日日夜夜精品| 91在线码无精品| 国产精品免费久久| 国产一区二区成人久久免费影院| 91精品国产综合久久久久久| 亚洲免费高清视频在线| 成人精品免费视频| 国产清纯白嫩初高生在线观看91| 九色综合狠狠综合久久| 欧美一级淫片007| 男男视频亚洲欧美| 宅男噜噜噜66一区二区66| 午夜免费久久看| 欧美亚洲国产一区二区三区| 亚洲欧美日韩系列| 91视频一区二区三区| 亚洲视频综合在线| 91九色最新地址| 一区二区三区资源| 欧美午夜一区二区| 日韩一区欧美二区| 在线不卡免费av| 人人狠狠综合久久亚洲| 制服丝袜亚洲网站| 美女脱光内衣内裤视频久久网站| 日韩欧美一卡二卡| 极品少妇一区二区| 国产日产欧产精品推荐色 | 精油按摩中文字幕久久| 精品国产露脸精彩对白| 国产综合久久久久影院| 国产欧美日本一区视频| 国产99一区视频免费| 中文字幕日韩一区二区| 色老综合老女人久久久| 亚洲国产综合色| 9191成人精品久久| 毛片av一区二区三区| 久久久久久9999| av在线一区二区三区| 亚洲国产日韩av| 日韩你懂的在线播放| 福利电影一区二区三区| 一区二区三区四区亚洲| 91精品综合久久久久久| 黄色精品一二区| 自拍偷拍欧美激情| 欧美美女一区二区在线观看| 精品在线你懂的| 亚洲欧美激情在线| 91精品国产日韩91久久久久久| 国产精一区二区三区| 亚洲三级久久久| 日韩一级大片在线| www.在线成人| 日韩电影免费一区|