extracting a rectangle containing texts
I wanted to know how I can extract a rectangle added to an image that contains text. Thank you very much in avance. for exemple i need to extract the blue rectange" PRIMAIRE: LES ECARTS SE RESSERRENT"
what have you tried, so far ?
(right now, it's only another "i want" question, showing no research, skill or effort)
I try many algorithme, detection of text and morphlogy segmentation.
Mat large = imread("result.png");
Mat small;
cvtColor(rgb, small, CV_BGR2GRAY); // morphological gradient
Mat grad;
morphologyEx(small, grad, MORPH_GRADIENT, morphKernel);
// binarize
Mat bw; threshold(grad, bw, 0.0, 255.0, THRESH_BINARY | THRESH_OTSU);
// connect horizontally oriented regions Mat connected;
morphKernel = getStructuringElement(MORPH_RECT, Size(9, 1));
morphologyEx(bw, connected, MORPH_CLOSE, morphKernel);
// find contours Mat mask = Mat::zeros(bw.size(), CV_8UC1);