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

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

?? seam.cpp

?? 一個google的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一区二区三区免费野_久草精品视频
国产麻豆91精品| 色成人在线视频| 一区二区免费看| 精品捆绑美女sm三区| 99国产精品一区| 国产精品一区二区在线看| 亚洲精品中文在线观看| 久久精品免视看| 3atv在线一区二区三区| 91欧美激情一区二区三区成人| 麻豆专区一区二区三区四区五区| 亚洲免费观看高清完整版在线| 久久视频一区二区| 欧美一级片在线| 欧美图片一区二区三区| 99天天综合性| 国产精品18久久久| 国内成人免费视频| 日韩国产欧美一区二区三区| 亚洲男人的天堂在线aⅴ视频| 国产三级久久久| 精品国产伦一区二区三区观看体验| 欧美色精品天天在线观看视频| 91在线精品一区二区| 国产成人一区二区精品非洲| 奇米影视一区二区三区| 亚洲一区二区三区三| 亚洲欧洲日韩在线| 国产亚洲美州欧州综合国| 精品裸体舞一区二区三区| 91精品国产手机| 欧美猛男超大videosgay| 在线观看免费一区| 91搞黄在线观看| 色婷婷精品久久二区二区蜜臂av| 91网址在线看| 99re66热这里只有精品3直播 | ww亚洲ww在线观看国产| 91精品婷婷国产综合久久性色| 欧美理论电影在线| 欧美日韩日日骚| 91麻豆精品91久久久久久清纯| 欧美三级电影网站| 欧美日韩国产a| 制服丝袜中文字幕一区| 91精品国产91综合久久蜜臀| 3d动漫精品啪啪| 欧美不卡视频一区| 久久婷婷色综合| 国产欧美一区二区在线观看| 久久久av毛片精品| 欧美激情在线看| 亚洲欧洲在线观看av| 亚洲精品五月天| 亚洲高清久久久| 美腿丝袜亚洲综合| 国产九色sp调教91| 成人免费电影视频| av在线不卡电影| 91福利视频久久久久| 欧美喷潮久久久xxxxx| 欧美成人福利视频| 国产欧美一区二区精品秋霞影院| 最新日韩av在线| 亚洲成人精品一区| 国产真实精品久久二三区| 成人18视频日本| 在线亚洲一区二区| 日韩写真欧美这视频| 久久噜噜亚洲综合| 一区二区三区在线看| 蜜臀av国产精品久久久久| 国产成人精品亚洲777人妖| 99视频精品在线| 日韩亚洲欧美综合| 国产精品国产精品国产专区不蜜| 亚洲国产一区视频| 国产一区二区三区四区在线观看 | 欧美亚洲尤物久久| 欧美成人精品福利| 中文字幕一区在线观看| 婷婷综合五月天| 国产成人日日夜夜| 欧美日韩一区三区四区| 久久精品欧美一区二区三区不卡| 亚洲最新在线观看| 国内久久精品视频| 欧美在线视频全部完| 久久久五月婷婷| 一区二区三区日韩| 国产不卡视频一区| 7777精品伊人久久久大香线蕉超级流畅| 久久免费国产精品| 亚洲一区二区三区中文字幕| 国产一区二区三区av电影| 在线观看网站黄不卡| 精品国产一区二区国模嫣然| 亚洲一二三四区不卡| 国产成人啪免费观看软件| 欧美一区二区三区播放老司机| 欧美韩日一区二区三区| 美女视频一区二区三区| 91美女精品福利| 国产婷婷色一区二区三区四区| 天堂蜜桃一区二区三区| 色综合视频在线观看| 久久亚洲二区三区| 天天综合色天天综合色h| 99久久久国产精品免费蜜臀| 精品成人免费观看| 午夜a成v人精品| 在线免费不卡电影| 欧美国产日本视频| 国产中文一区二区三区| 欧美一区二区三区免费大片| 亚洲精品国产精华液| 成人精品视频一区二区三区尤物| 日韩欧美一区二区三区在线| 亚洲成av人片一区二区三区| 色综合久久中文字幕| 国产精品久久久久永久免费观看 | 激情综合色播激情啊| 欧美精品1区2区| 午夜视频在线观看一区二区三区| 91丨九色丨尤物| 中文字幕欧美激情一区| 国产美女精品一区二区三区| 日韩免费观看2025年上映的电影| 日韩精品久久理论片| 欧美三级视频在线| 亚洲成人高清在线| 欧美又粗又大又爽| 亚洲福利一二三区| 欧美在线999| 亚洲成av人片在www色猫咪| 在线亚洲一区观看| 亚洲综合免费观看高清完整版| 99riav一区二区三区| 国产精品久久久久久妇女6080| 成人一级黄色片| 国产精品麻豆网站| 99视频超级精品| 亚洲精品一二三| 欧美日韩久久久一区| 亚洲午夜在线电影| 欧美日韩精品欧美日韩精品一 | 国产精品国产精品国产专区不片| 成人精品视频一区二区三区| 最新久久zyz资源站| 色乱码一区二区三区88| 亚洲国产精品久久人人爱蜜臀| 精品视频1区2区| 日日夜夜免费精品视频| 日韩欧美一区电影| 国产a精品视频| 亚洲乱码中文字幕综合| 精品视频一区二区三区免费| 日韩成人一级大片| 精品99999| 99视频精品全部免费在线| 亚洲综合一区二区| 91精品国产综合久久福利| 精东粉嫩av免费一区二区三区| 国产午夜精品美女毛片视频| 99国产精品久久久| 日韩精品一级中文字幕精品视频免费观看| 日韩视频一区二区三区| 国产福利一区在线观看| 一区二区在线免费| 制服丝袜中文字幕亚洲| 国产a级毛片一区| 亚洲成人精品影院| 国产欧美一区二区精品仙草咪| 91视频一区二区三区| 日韩av在线播放中文字幕| 久久精品网站免费观看| 在线亚洲一区观看| 国产一二三精品| 亚洲一卡二卡三卡四卡五卡| 亚洲精品在线网站| 91亚洲精品乱码久久久久久蜜桃| 日韩高清在线不卡| 国产精品国产自产拍高清av| 69av一区二区三区| 国产99久久久久久免费看农村| 香蕉av福利精品导航| 国产日韩欧美一区二区三区综合| 欧美日韩一区二区欧美激情| 国产麻豆91精品| 天天综合网天天综合色| 国产精品国产馆在线真实露脸| 日韩色在线观看| 91麻豆国产精品久久| 经典三级在线一区| 亚洲一区二区三区免费视频| 欧美激情一区二区三区四区 | 伦理电影国产精品| 亚洲精品国产视频| 国产日韩欧美综合一区| 欧美一级黄色大片|