Tesseract  3.02
tesseract-ocr/textord/blobgrid.cpp
Go to the documentation of this file.
00001 
00002 // File:        blobgrid.h
00003 // Description: BBGrid of BLOBNBOX with useful BLOBNBOX-specific methods.
00004 // Copyright 2011 Google Inc. All Rights Reserved.
00005 // Author: rays@google.com (Ray Smith)
00006 // Created:     Sat Jun 11 10:30:01 PST 2011
00007 //
00008 // Licensed under the Apache License, Version 2.0 (the "License");
00009 // you may not use this file except in compliance with the License.
00010 // You may obtain a copy of the License at
00011 // http://www.apache.org/licenses/LICENSE-2.0
00012 // Unless required by applicable law or agreed to in writing, software
00013 // distributed under the License is distributed on an "AS IS" BASIS,
00014 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015 // See the License for the specific language governing permissions and
00016 // limitations under the License.
00017 //
00019 
00020 #include "blobgrid.h"
00021 
00022 namespace tesseract {
00023 
00024 BlobGrid::BlobGrid(int gridsize, const ICOORD& bleft, const ICOORD& tright)
00025   : BBGrid<BLOBNBOX, BLOBNBOX_CLIST, BLOBNBOX_C_IT>(gridsize, bleft, tright) {
00026 }
00027 
00028 BlobGrid::~BlobGrid() {
00029 }
00030 
00031 // Inserts all the blobs from the given list, with x and y spreading,
00032 // without removing from the source list, so ownership remains with the
00033 // source list.
00034 void BlobGrid::InsertBlobList(BLOBNBOX_LIST* blobs) {
00035   BLOBNBOX_IT blob_it(blobs);
00036   for (blob_it.mark_cycle_pt(); !blob_it.cycled_list(); blob_it.forward()) {
00037     BLOBNBOX* blob = blob_it.data();
00038     if (!blob->joined_to_prev())
00039       InsertBBox(true, true, blob);
00040   }
00041 }
00042 
00043 
00044 }  // namespace tesseract.