Commit 786876c0 authored by lluis's avatar lluis

Adds The exhaustive search algorithm and updates the previous grouping code

parent 890073a1
......@@ -239,6 +239,12 @@ enum { ERFILTER_NM_RGBLGrad = 0,
CV_EXPORTS void computeNMChannels(InputArray _src, OutputArrayOfArrays _channels, int _mode = ERFILTER_NM_RGBLGrad);
// erGrouping operation modes
enum { ERGROUPING_ORIENTATION_HORIZ = 0,
ERGROUPING_ORIENTATION_ANY = 1
};
/*!
Find groups of Extremal Regions that are organized as text blocks. This function implements
the grouping algorithm described in:
......@@ -260,9 +266,13 @@ CV_EXPORTS void computeNMChannels(InputArray _src, OutputArrayOfArrays _channels
\param minProbability The minimum probability for accepting a group
\param groups The output of the algorithm are stored in this parameter as list of rectangles.
*/
CV_EXPORTS void erGrouping(InputArrayOfArrays src, std::vector<std::vector<ERStat> > &regions,
const std::string& filename, float minProbablity,
std::vector<Rect > &groups);
CV_EXPORTS void erGrouping(InputArray img, InputArrayOfArrays channels,
std::vector<std::vector<ERStat> > &regions,
std::vector<std::vector<Vec2i> > &groups,
std::vector<Rect> &groups_rects,
int method = ERGROUPING_ORIENTATION_HORIZ,
const std::string& filename = std::string(),
float minProbablity = 0.5);
}
}
......
......@@ -59,11 +59,16 @@ int main(int argc, const char * argv[])
// Detect character groups
cout << "Grouping extracted ERs ... ";
vector<Rect> groups;
erGrouping(channels, regions, "trained_classifier_erGrouping.xml", 0.5, groups);
cout << "image size "<< src.cols << "x" << src.rows << endl;
vector< vector<Vec2i> > region_groups;
vector<Rect> groups_boxes;
erGrouping(src, channels, regions, region_groups, groups_boxes, ERGROUPING_ORIENTATION_HORIZ);
//erGrouping(src, channels, regions, region_groups, groups_boxes, ERGROUPING_ORIENTATION_ANY, "./trained_classifier_erGrouping.xml", 0.5);
// draw groups
groups_draw(src, groups);
cout << "image size "<< src.cols << "x" << src.rows << endl;
groups_draw(src, groups_boxes);
cout << "image size "<< src.cols << "x" << src.rows << endl;
imshow("grouping",src);
cout << "Done!" << endl << endl;
......@@ -75,9 +80,9 @@ int main(int argc, const char * argv[])
er_filter1.release();
er_filter2.release();
regions.clear();
if (!groups.empty())
if (!groups_boxes.empty())
{
groups.clear();
groups_boxes.clear();
}
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment