Skip to content

Commit

Permalink
Stopped error messages from pixaGetCount
Browse files Browse the repository at this point in the history
  • Loading branch information
theraysmith committed Dec 14, 2016
1 parent 13e46ae commit 5129c43
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion textord/devanagari_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ bool ShiroRekhaSplitter::Split(bool split_for_pageseg) {
// out the image regions corresponding to these boxes from the original image.
// Conditionally run splitting on each of them.
Boxa* regions_to_clear = boxaCreate(0);
for (int i = 0; i < pixaGetCount(ccs); ++i) {
int num_ccs = 0;
if (ccs != nullptr) num_ccs = pixaGetCount(ccs);
for (int i = 0; i < num_ccs; ++i) {
Box* box = ccs->boxa->box[i];
Pix* word_pix = pixClipRectangle(orig_pix_, box, NULL);
ASSERT_HOST(word_pix);
Expand Down
6 changes: 4 additions & 2 deletions textord/imagefind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ void ImageFind::ConnCompAndRectangularize(Pix* pix, Boxa** boxa, Pixa** pixa) {
// Rectangularize the individual images. If a sharp edge in vertical and/or
// horizontal occupancy can be found, it indicates a probably rectangular
// image with unwanted bits merged on, so clip to the approximate rectangle.
int npixes = pixaGetCount(*pixa);
int npixes = 0;
if (*boxa != nullptr && *pixa != nullptr) npixes = pixaGetCount(*pixa);
for (int i = 0; i < npixes; ++i) {
int x_start, x_end, y_start, y_end;
Pix* img_pix = pixaGetPix(*pixa, i, L_CLONE);
Expand Down Expand Up @@ -1293,7 +1294,8 @@ void ImageFind::FindImagePartitions(Pix* image_pix,
Pixa* pixa;
ConnCompAndRectangularize(image_pix, &boxa, &pixa);
// Iterate the connected components in the image regions mask.
int nboxes = boxaGetCount(boxa);
int nboxes = 0;
if (boxa != nullptr && pixa != nullptr) nboxes = boxaGetCount(boxa);
for (int i = 0; i < nboxes; ++i) {
l_int32 x, y, width, height;
boxaGetBoxGeometry(boxa, i, &x, &y, &width, &height);
Expand Down

0 comments on commit 5129c43

Please sign in to comment.