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

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

?? seam.cpp

?? 一OCR的相關資料。.希望對研究OCR的朋友有所幫助.
?? CPP
字號:
/* -*-C-*- ******************************************************************************** * * File:        seam.c  (Formerly seam.c) * Description: * Author:       Mark Seaman, OCR Technology * Created:      Fri Oct 16 14:37:00 1987 * Modified:     Fri May 17 16:30:13 1991 (Mark Seaman) marks@hpgrlt * Language:     C * Package:      N/A * Status:       Reusable Software Component * * (c) Copyright 1987, Hewlett-Packard Company. ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** http://www.apache.org/licenses/LICENSE-2.0 ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. * *********************************************************************************//*----------------------------------------------------------------------              I n c l u d e s----------------------------------------------------------------------*/#include "seam.h"#include "callcpp.h"#include "structures.h"#include "makechop.h"#ifdef __UNIX__#include <assert.h>#endif/*----------------------------------------------------------------------              V a r i a b l e s----------------------------------------------------------------------*/#define NUM_STARTING_SEAMS  20#define SEAMBLOCK 100            /* Cells per block */makestructure (newseam, free_seam, printseam, SEAM,freeseam, SEAMBLOCK, "SEAM", seamcount);/*----------------------------------------------------------------------        Public Function Code----------------------------------------------------------------------*//********************************************************************** * point_in_split * * Check to see if either of these points are present in the current * split.  Return TRUE if one of them is. **********************************************************************/bool point_in_split(SPLIT *split, EDGEPT *point1, EDGEPT *point2) {  return ((split) ?    ((exact_point (split->point1, point1) ||    exact_point (split->point1, point2) ||    exact_point (split->point2, point1) ||    exact_point (split->point2, point2)) ? TRUE : FALSE) : FALSE);}/********************************************************************** * point_in_seam * * Check to see if either of these points are present in the current * seam.  Return TRUE if one of them is. **********************************************************************/bool point_in_seam(SEAM *seam, SPLIT *split) {  return (point_in_split (seam->split1, split->point1, split->point2) ||    point_in_split (seam->split2, split->point1, split->point2) ||    point_in_split (seam->split3, split->point1, split->point2));}/********************************************************************** * add_seam * * Add another seam to a collection of seams. **********************************************************************/SEAMS add_seam(SEAMS seam_list, SEAM *seam) {  return (array_push (seam_list, seam));}/********************************************************************** * combine_seam * * Combine two seam records into a single seam.  Move the split * references from the second seam to the first one.  The argument * convention is patterned after strcpy. **********************************************************************/void combine_seams(SEAM *dest_seam, SEAM *source_seam) {  dest_seam->priority += source_seam->priority;  dest_seam->location += source_seam->location;  dest_seam->location /= 2;  if (source_seam->split1) {    if (!dest_seam->split1)      dest_seam->split1 = source_seam->split1;    else if (!dest_seam->split2)      dest_seam->split2 = source_seam->split1;    else if (!dest_seam->split3)      dest_seam->split3 = source_seam->split1;    else      cprintf ("combine_seam: Seam is too crowded, can't be combined !\n");  }  if (source_seam->split2) {    if (!dest_seam->split2)      dest_seam->split2 = source_seam->split2;    else if (!dest_seam->split3)      dest_seam->split3 = source_seam->split2;    else      cprintf ("combine_seam: Seam is too crowded, can't be combined !\n");  }  if (source_seam->split3) {    if (!dest_seam->split3)      dest_seam->split3 = source_seam->split3;    else      cprintf ("combine_seam: Seam is too crowded, can't be combined !\n");  }  free_seam(source_seam);}/********************************************************************** * delete_seam * * Free this seam record and the splits that are attached to it. **********************************************************************/void delete_seam(void *arg) {  //SEAM  *seam)  SEAM *seam = (SEAM *) arg;  if (seam) {    if (seam->split1)      delete_split (seam->split1);    if (seam->split2)      delete_split (seam->split2);    if (seam->split3)      delete_split (seam->split3);    free_seam(seam);  }}/********************************************************************** * free_seam_list * * Free all the seams that have been allocated in this list.  Reclaim * the memory for each of the splits as well. **********************************************************************/void free_seam_list(SEAMS seam_list) {  int x;  array_loop (seam_list, x) delete_seam (array_value (seam_list, x));  array_free(seam_list);}/********************************************************************** * test_insert_seam * * Return true if insert_seam will succeed. **********************************************************************/bool test_insert_seam(SEAMS seam_list,                      int index,                      TBLOB *left_blob,                      TBLOB *first_blob) {  SEAM *test_seam;  TBLOB *blob;  int test_index;  int list_length;  list_length = array_count (seam_list);  for (test_index = 0, blob = first_blob->next;  test_index < index; test_index++, blob = blob->next) {    test_seam = (SEAM *) array_value (seam_list, test_index);    if (test_index + test_seam->widthp < index &&        test_seam->widthp + test_index == index - 1 &&        account_splits_right(test_seam, blob) < 0)      return false;  }  for (test_index = index, blob = left_blob->next;  test_index < list_length; test_index++, blob = blob->next) {    test_seam = (SEAM *) array_value (seam_list, test_index);    if (test_index - test_seam->widthn >= index &&        test_index - test_seam->widthn == index &&        account_splits_left(test_seam, first_blob, blob) < 0)      return false;  }  return true;}/********************************************************************** * insert_seam * * Add another seam to a collection of seams at a particular location * in the seam array. **********************************************************************/SEAMS insert_seam(SEAMS seam_list,                  int index,                  SEAM *seam,                  TBLOB *left_blob,                  TBLOB *first_blob) {  SEAM *test_seam;  TBLOB *blob;  int test_index;  int list_length;  list_length = array_count (seam_list);  for (test_index = 0, blob = first_blob->next;  test_index < index; test_index++, blob = blob->next) {    test_seam = (SEAM *) array_value (seam_list, test_index);    if (test_index + test_seam->widthp >= index) {      test_seam->widthp++;       /*got in the way */    }    else if (test_seam->widthp + test_index == index - 1) {      test_seam->widthp = account_splits_right(test_seam, blob);      if (test_seam->widthp < 0) {        cprintf ("Failed to find any right blob for a split!\n");        print_seam("New dud seam", seam);        print_seam("Failed seam", test_seam);      }    }  }  for (test_index = index, blob = left_blob->next;  test_index < list_length; test_index++, blob = blob->next) {    test_seam = (SEAM *) array_value (seam_list, test_index);    if (test_index - test_seam->widthn < index) {      test_seam->widthn++;       /*got in the way */    }    else if (test_index - test_seam->widthn == index) {      test_seam->widthn = account_splits_left(test_seam, first_blob, blob);      if (test_seam->widthn < 0) {        cprintf ("Failed to find any left blob for a split!\n");        print_seam("New dud seam", seam);        print_seam("Failed seam", test_seam);      }    }  }  return (array_insert (seam_list, index, seam));}/********************************************************************** * account_splits_right * * Account for all the splits by looking to the right. * in the blob list. **********************************************************************/int account_splits_right(SEAM *seam, TBLOB *blob) {  INT8 found_em[3];  INT8 width;  found_em[0] = seam->split1 == NULL;  found_em[1] = seam->split2 == NULL;  found_em[2] = seam->split3 == NULL;  if (found_em[0] && found_em[1] && found_em[2])    return 0;  width = 0;  do {    if (!found_em[0])      found_em[0] = find_split_in_blob (seam->split1, blob);    if (!found_em[1])      found_em[1] = find_split_in_blob (seam->split2, blob);    if (!found_em[2])      found_em[2] = find_split_in_blob (seam->split3, blob);    if (found_em[0] && found_em[1] && found_em[2]) {      return width;    }    width++;    blob = blob->next;  }  while (blob != NULL);  return -1;}/********************************************************************** * account_splits_left * * Account for all the splits by looking to the left. * in the blob list. **********************************************************************/int account_splits_left(SEAM *seam, TBLOB *blob, TBLOB *end_blob) {  static INT32 depth = 0;  static INT8 width;  static INT8 found_em[3];  if (blob != end_blob) {    depth++;    account_splits_left (seam, blob->next, end_blob);    depth--;  }  else {    found_em[0] = seam->split1 == NULL;    found_em[1] = seam->split2 == NULL;    found_em[2] = seam->split3 == NULL;    width = 0;  }  if (!found_em[0])    found_em[0] = find_split_in_blob (seam->split1, blob);  if (!found_em[1])    found_em[1] = find_split_in_blob (seam->split2, blob);  if (!found_em[2])    found_em[2] = find_split_in_blob (seam->split3, blob);  if (!found_em[0] || !found_em[1] || !found_em[2]) {    width++;    if (depth == 0) {      width = -1;    }  }  return width;}/********************************************************************** * find_split_in_blob * * Return TRUE if the split is somewhere in this blob. **********************************************************************/bool find_split_in_blob(SPLIT *split, TBLOB *blob) {  TESSLINE *outline;#if 0  for (outline = blob->outlines; outline != NULL; outline = outline->next)    if (is_split_outline (outline, split))      return TRUE;  return FALSE;#endif  for (outline = blob->outlines; outline != NULL; outline = outline->next)    if (point_in_outline(split->point1, outline))      break;  if (outline == NULL)    return FALSE;  for (outline = blob->outlines; outline != NULL; outline = outline->next)    if (point_in_outline(split->point2, outline))      return TRUE;  return FALSE;}/********************************************************************** * join_two_seams * * Merge these two seams into a new seam.  Duplicate the split records * in both of the input seams.  Return the resultant seam. **********************************************************************/SEAM *join_two_seams(SEAM *seam1, SEAM *seam2) {  SEAM *result = NULL;  SEAM *temp;  assert(seam1 &&seam2);  if ((seam1->split3 == NULL && seam2->split2 == NULL ||    seam1->split2 == NULL && seam2->split3 == NULL ||    seam1->split1 == NULL ||  seam2->split1 == NULL) && (!shared_split_points (seam1, seam2))) {    clone_seam(result, seam1);    clone_seam(temp, seam2);    combine_seams(result, temp);  }  return (result);}/********************************************************************** * new_seam * * Create a structure for a "seam" between two blobs.  This data * structure may actually hold up to three different splits. * Initailization of this record is done by this routine. **********************************************************************/SEAM *new_seam(PRIORITY priority,               int x_location,               SPLIT *split1,               SPLIT *split2,               SPLIT *split3) {  SEAM *seam;  seam = newseam ();  seam->priority = priority;  seam->location = x_location;  seam->widthp = 0;  seam->widthn = 0;  seam->split1 = split1;  seam->split2 = split2;  seam->split3 = split3;  return (seam);}/********************************************************************** * new_seam_list * * Create a collection of seam records in an array. **********************************************************************/SEAMS new_seam_list() {  return (array_new (NUM_STARTING_SEAMS));}/********************************************************************** * print_seam * * Print a list of splits.  Show the coordinates of both points in * each split. **********************************************************************/void print_seam(const char *label, SEAM *seam) {  if (seam) {    cprintf(label);    cprintf (" %6.2f @ %5d, p=%d, n=%d ",      seam->priority, seam->location, seam->widthp, seam->widthn);    print_split (seam->split1);    if (seam->split2) {      cprintf (",   ");      print_split (seam->split2);      if (seam->split3) {        cprintf (",   ");        print_split (seam->split3);      }    }    cprintf ("\n");  }}/********************************************************************** * print_seams * * Print a list of splits.  Show the coordinates of both points in * each split. **********************************************************************/void print_seams(const char *label, SEAMS seams) {  int x;  char number[CHARS_PER_LINE];  if (seams) {    cprintf ("%s\n", label);    array_loop(seams, x) {      sprintf (number, "%2d:   ", x);      print_seam (number, (SEAM *) array_value (seams, x));    }    cprintf ("\n");  }}/********************************************************************** * shared_split_points * * Check these two seams to make sure that neither of them have two * points in common. Return TRUE if any of the same points are present * in any of the splits of both seams. **********************************************************************/int shared_split_points(SEAM *seam1, SEAM *seam2) {  if (seam1 == NULL || seam2 == NULL)    return (FALSE);  if (seam2->split1 == NULL)    return (FALSE);  if (point_in_seam (seam1, seam2->split1))    return (TRUE);  if (seam2->split2 == NULL)    return (FALSE);  if (point_in_seam (seam1, seam2->split2))    return (TRUE);  if (seam2->split3 == NULL)    return (FALSE);  if (point_in_seam (seam1, seam2->split3))    return (TRUE);  return (FALSE);}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲电影一区二区三区| 亚洲欧洲成人av每日更新| 538在线一区二区精品国产| 久久精品国产网站| 欧美aaaaa成人免费观看视频| 91精品国产aⅴ一区二区| 91在线观看污| 国产在线视频精品一区| 亚洲国产日韩a在线播放性色| 欧美xxxx在线观看| 欧美在线看片a免费观看| av资源站一区| 麻豆91免费看| 午夜成人免费视频| 成人免费在线视频观看| www久久精品| 日韩欧美精品在线视频| 色老头久久综合| eeuss影院一区二区三区| 韩国精品久久久| 日韩电影在线看| 午夜精品久久久久| 综合激情成人伊人| 国产精品免费视频观看| 中文字幕乱码日本亚洲一区二区 | 一区二区三区四区在线播放| 亚洲欧美色一区| 天天亚洲美女在线视频| 亚欧色一区w666天堂| 久久成人久久爱| 日韩精品亚洲专区| 亚洲国产精品99久久久久久久久| 欧美精品在线观看播放| 成人影视亚洲图片在线| kk眼镜猥琐国模调教系列一区二区| 国产精品嫩草久久久久| 久久99久久99精品免视看婷婷| 91精品蜜臀在线一区尤物| 蜜臀av一区二区在线免费观看| 国产欧美1区2区3区| 欧美在线播放高清精品| 男人的天堂久久精品| 成人一道本在线| 日韩国产在线观看一区| 亚洲日本丝袜连裤袜办公室| 亚洲三级在线观看| 夜色激情一区二区| 黄色日韩网站视频| 亚洲另类在线一区| 色一情一乱一乱一91av| www.欧美.com| 欧美日韩一级大片网址| 国产欧美日韩中文久久| 一个色妞综合视频在线观看| 激情综合一区二区三区| 在线一区二区视频| 欧美日韩精品一区二区在线播放 | 欧美日韩精品欧美日韩精品一综合| 欧美一级二级三级蜜桃| 亚洲日本va在线观看| 色伊人久久综合中文字幕| 精品欧美一区二区三区精品久久 | 亚洲欧美经典视频| 成人黄动漫网站免费app| 日韩免费一区二区| 丝袜美腿亚洲色图| 欧美日韩一区不卡| 国产乱子轮精品视频| 日韩美女在线视频| 午夜伦欧美伦电影理论片| 欧美四级电影网| 亚洲国产精品人人做人人爽| 欧美日韩国产综合一区二区三区| 亚洲九九爱视频| 欧美中文一区二区三区| 亚洲图片自拍偷拍| 欧美日韩国产经典色站一区二区三区| 亚洲女同ⅹxx女同tv| 欧美日韩精品一区二区天天拍小说 | 国产精品麻豆久久久| 91丝袜国产在线播放| 亚洲成人自拍网| 日韩一区二区三区免费看| 国产精选一区二区三区| 中文av字幕一区| 欧美精品黑人性xxxx| 国产一区二区三区免费播放| 国产欧美日韩不卡| 日本韩国一区二区三区| 免费亚洲电影在线| 国产精品视频yy9299一区| 在线欧美日韩国产| 激情丁香综合五月| 亚洲一区二区三区四区五区黄 | 色婷婷综合久色| 免费成人在线网站| 亚洲精品中文在线| 久久综合久久久久88| 色哟哟日韩精品| 国产毛片精品视频| 亚洲成人精品一区二区| 国产精品成人网| 亚洲第一成年网| 国产精品久久久久三级| 日韩精品最新网址| 在线观看亚洲a| 成人丝袜18视频在线观看| 日韩中文欧美在线| 亚洲精品成人在线| 一区二区三区在线播| 欧美国产日产图区| 日韩精品在线网站| 日韩欧美成人激情| 欧美在线不卡一区| 在线观看日韩电影| 色综合咪咪久久| 99re视频精品| 色综合中文字幕国产 | 丝袜亚洲精品中文字幕一区| 日韩理论片中文av| 亚洲精品日韩综合观看成人91| 久久久久97国产精华液好用吗| 精品日韩欧美在线| 日韩精品一区二区三区swag| 日韩视频一区二区| 精品剧情v国产在线观看在线| 欧美疯狂做受xxxx富婆| 3atv在线一区二区三区| 91精品国产黑色紧身裤美女| 欧美精品xxxxbbbb| 337p亚洲精品色噜噜噜| 久久人人爽人人爽| 国产精品久久久久国产精品日日| 国产精品福利在线播放| 亚洲男人天堂一区| 青青草国产精品亚洲专区无| 国产精品一二三四区| 国产成人精品一区二区三区网站观看| a级精品国产片在线观看| 欧美日韩亚洲综合一区 | 亚洲国产视频a| 91麻豆精品国产综合久久久久久| 欧美mv日韩mv亚洲| 亚洲国产日日夜夜| 成人综合婷婷国产精品久久免费| 色综合久久久久久久| 日韩欧美中文字幕制服| 中文字幕在线一区二区三区| 亚洲h精品动漫在线观看| 粉嫩久久99精品久久久久久夜| 欧美日韩成人高清| 中文字幕日本乱码精品影院| 久久99深爱久久99精品| 一本色道久久综合亚洲精品按摩| 91精品久久久久久久99蜜桃| 国产精品久久久久永久免费观看| 日日夜夜精品视频天天综合网| 久久成人免费电影| 欧美视频在线一区二区三区| 久久亚洲一级片| 偷拍一区二区三区四区| 一本色道久久综合亚洲91 | 免费看欧美美女黄的网站| 在线电影国产精品| 麻豆精品久久精品色综合| 色综合中文字幕| 亚洲成人动漫精品| 欧美午夜精品一区| 亚洲一区二区精品视频| 精品视频一区二区三区免费| 三级影片在线观看欧美日韩一区二区| 欧美日韩中字一区| 老汉av免费一区二区三区| 日韩精品中文字幕一区二区三区| 国产一区日韩二区欧美三区| 久久久久久久久伊人| 成人开心网精品视频| 一区二区成人在线| 色香蕉久久蜜桃| 视频一区二区三区在线| 国产欧美日韩视频一区二区| 91在线小视频| 五月天婷婷综合| 久久精品视频一区| 色香蕉成人二区免费| 日韩二区三区四区| 国产亲近乱来精品视频| 99久久99久久精品免费看蜜桃| 亚洲国产成人91porn| 亚洲久草在线视频| 555www色欧美视频| 99re8在线精品视频免费播放| 午夜精品免费在线| 久久先锋资源网| 6080午夜不卡| 欧美无砖专区一中文字| 国产激情一区二区三区| 亚洲视频网在线直播| 中文字幕av资源一区| 欧美精品黑人性xxxx|