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

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

?? findblob.c

?? NIST Handwriting OCR Testbed
?? C
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/*# 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++)

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
蜜臀av性久久久久蜜臀aⅴ四虎| 国产成人av一区二区三区在线观看| 一区二区三区免费网站| 国产精品久久久久久久久图文区 | 免费日韩伦理电影| 国产精品色婷婷| 国产精品嫩草影院av蜜臀| 国产欧美中文在线| 国产色产综合色产在线视频| 久久久精品黄色| 国产精品久久久一区麻豆最新章节| 亚洲国产精品精华液2区45| 亚洲国产精品传媒在线观看| 国产精品人人做人人爽人人添| 国产精品久久久久永久免费观看 | 国产视频视频一区| 欧美激情综合五月色丁香小说| 日本一区二区三区国色天香 | 久久aⅴ国产欧美74aaa| 国产精品久久久久久久久图文区| 日韩欧美精品在线| 久久天天做天天爱综合色| 国产欧美精品一区| 最新国产成人在线观看| 亚洲国产综合色| 青青草一区二区三区| 国产在线观看免费一区| 不卡一区在线观看| 欧美日韩五月天| 欧美成人video| 国产精品乱人伦| 亚洲五码中文字幕| 久久99精品久久久久| 成人免费看片app下载| 在线免费观看日本一区| 日韩午夜av电影| 国产精品成人一区二区艾草 | 91免费视频观看| 欧美精品第一页| 国产午夜精品一区二区三区四区| 亚洲欧美成aⅴ人在线观看| 蜜芽一区二区三区| 懂色av一区二区三区蜜臀| 欧美三级视频在线| 国产午夜精品一区二区三区四区| 夜夜嗨av一区二区三区中文字幕| 久久99久久久欧美国产| 日韩视频免费直播| 欧美极品aⅴ影院| 欧美日韩国产综合一区二区| 99久久精品国产精品久久| 91麻豆精品91久久久久同性| 国产三级精品三级| 视频精品一区二区| 成人97人人超碰人人99| 日韩欧美高清在线| 亚洲乱码国产乱码精品精98午夜| 国产真实乱子伦精品视频| 欧美在线综合视频| 中文字幕不卡一区| 美女诱惑一区二区| 欧美在线视频不卡| 中文子幕无线码一区tr| 麻豆精品一区二区三区| 欧美综合一区二区| 国产精品美女一区二区三区| 蜜桃精品视频在线| 欧美日韩成人一区二区| 中文字幕一区av| 国产一区二区视频在线播放| 在线成人高清不卡| 一区二区三区欧美日| 福利电影一区二区| 精品国产乱码久久久久久图片| 亚洲va在线va天堂| 日本伦理一区二区| 国产欧美一区二区三区在线老狼| 精品一区二区在线观看| 色菇凉天天综合网| 亚洲午夜激情网页| 国内成+人亚洲+欧美+综合在线| 欧美日韩免费观看一区三区| ●精品国产综合乱码久久久久| 国产高清成人在线| 欧美mv和日韩mv国产网站| 免费看黄色91| 欧美久久久久中文字幕| 亚洲成人精品一区二区| 色又黄又爽网站www久久| 国产精品美女久久久久久| 国产激情一区二区三区| 久久久蜜桃精品| 国产麻豆视频一区| wwwwww.欧美系列| 久久精品久久99精品久久| 91精品国产综合久久久久久久久久| 亚洲自拍偷拍九九九| 色婷婷综合久久久中文一区二区| 亚洲欧洲av在线| 北条麻妃一区二区三区| 国产精品久久久久久妇女6080| 国产成人啪午夜精品网站男同| 久久精品无码一区二区三区| 国内精品不卡在线| 国产日韩av一区二区| 成人爽a毛片一区二区免费| 欧美国产日韩一二三区| 欧美军同video69gay| 成人动漫中文字幕| 欧美视频在线一区| 天天色天天爱天天射综合| 欧美精品一级二级三级| 日本视频一区二区| 日韩欧美一级二级三级久久久| 美女mm1313爽爽久久久蜜臀| 精品国产乱码久久久久久久久| 国产一区二区三区综合| 欧美国产97人人爽人人喊| 成人免费视频一区| 一区二区三区精品| 欧美区一区二区三区| 美美哒免费高清在线观看视频一区二区 | 亚洲综合图片区| 精品视频资源站| 男女性色大片免费观看一区二区 | 亚洲综合免费观看高清完整版在线| 91福利资源站| 日韩av一区二区三区四区| 精品sm捆绑视频| 丁香啪啪综合成人亚洲小说| 亚洲人成伊人成综合网小说| 91丝袜高跟美女视频| 欧美日韩一区 二区 三区 久久精品| 老汉av免费一区二区三区| 亚洲国产精品久久久久婷婷884| 国产成a人亚洲精| 一色屋精品亚洲香蕉网站| 欧美午夜在线一二页| 另类专区欧美蜜桃臀第一页| 国产欧美精品一区aⅴ影院 | 不卡区在线中文字幕| 亚洲综合区在线| 欧美精品一区二区三区视频| av中文字幕亚洲| 日韩电影在线观看一区| 国产夜色精品一区二区av| 欧美在线观看视频一区二区| 久久99久久久久久久久久久| 中文字幕在线观看不卡视频| 欧美一区二区三区啪啪| 国产成人自拍高清视频在线免费播放| 亚洲欧美日韩国产综合| 日韩女优制服丝袜电影| 99久久精品国产导航| 美女爽到高潮91| 亚洲一区影音先锋| 日本一区二区免费在线| 欧美精品第1页| 91免费视频网| 国产最新精品免费| 午夜精品福利一区二区蜜股av| 国产欧美精品一区| 日韩欧美一区二区视频| 色美美综合视频| 国产剧情一区二区| 调教+趴+乳夹+国产+精品| 国产精品国产三级国产普通话三级 | 欧美天天综合网| 成人黄色av电影| 精品一区二区三区视频| 亚洲国产一区二区三区| 国产欧美日韩一区二区三区在线观看| 欧美日韩国产123区| 99久久精品国产精品久久| 国产精品影视天天线| 日本一区中文字幕| 亚洲自拍偷拍av| 亚洲色图一区二区三区| 国产偷v国产偷v亚洲高清| 日韩久久久精品| 51午夜精品国产| 欧美午夜寂寞影院| 色菇凉天天综合网| 99这里都是精品| 成人晚上爱看视频| 国产成人综合在线| 国内精品免费在线观看| 美女网站在线免费欧美精品| 天堂影院一区二区| 亚洲无人区一区| 亚洲综合999| 一区二区欧美视频| 一区二区三区不卡在线观看| 日韩一区欧美小说| 亚洲视频资源在线| 中文字幕一区二区三区乱码在线| 久久久久久久久久久久久久久99 | 欧美性色黄大片手机版| 一本到不卡免费一区二区| 色综合久久久久久久久|