Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions TextDetection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -525,21 +525,21 @@ findLegallyConnectedComponents (IplImage * SWTImage,
int this_pixel = map[row * SWTImage->width + col];
if (col+1 < SWTImage->width) {
float right = CV_IMAGE_ELEM(SWTImage, float, row, col+1);
if (right > 0 && ((*ptr)/right <= 3.0 || right/(*ptr) <= 3.0))
if (right > 0 && ((*ptr)/right <= 3.0 && right/(*ptr) <= 3.0))
boost::add_edge(this_pixel, map.at(row * SWTImage->width + col + 1), g);
}
if (row+1 < SWTImage->height) {
if (col+1 < SWTImage->width) {
float right_down = CV_IMAGE_ELEM(SWTImage, float, row+1, col+1);
if (right_down > 0 && ((*ptr)/right_down <= 3.0 || right_down/(*ptr) <= 3.0))
if (right_down > 0 && ((*ptr)/right_down <= 3.0 && right_down/(*ptr) <= 3.0))
boost::add_edge(this_pixel, map.at((row+1) * SWTImage->width + col + 1), g);
}
float down = CV_IMAGE_ELEM(SWTImage, float, row+1, col);
if (down > 0 && ((*ptr)/down <= 3.0 || down/(*ptr) <= 3.0))
if (down > 0 && ((*ptr)/down <= 3.0 && down/(*ptr) <= 3.0))
boost::add_edge(this_pixel, map.at((row+1) * SWTImage->width + col), g);
if (col-1 >= 0) {
float left_down = CV_IMAGE_ELEM(SWTImage, float, row+1, col-1);
if (left_down > 0 && ((*ptr)/left_down <= 3.0 || left_down/(*ptr) <= 3.0))
if (left_down > 0 && ((*ptr)/left_down <= 3.0 && left_down/(*ptr) <= 3.0))
boost::add_edge(this_pixel, map.at((row+1) * SWTImage->width + col - 1), g);
}
}
Expand Down Expand Up @@ -602,7 +602,7 @@ findLegallyConnectedComponentsRAY (IplImage * SWTImage,
for (std::vector<Point2d>::const_iterator it2 = it->points.begin(); it2 != it->points.end(); it2++) {
float currentSW = CV_IMAGE_ELEM(SWTImage, float, it2->y, it2->x);
if (lastSW == 0) {}
else if (lastSW/currentSW<=3.0 || currentSW/lastSW<=3.0){
else if (lastSW/currentSW<=3.0 && currentSW/lastSW<=3.0){
boost::add_edge(map.at(it2->y * SWTImage->width + it2->x), map.at(lastRow * SWTImage->width + lastCol), g);
}
lastSW = currentSW;
Expand Down