Ask Your Question

HappyForce2's profile - activity

2015-06-05 16:43:10 -0600 commented answer Line segment detection Near horizontal

Strange... locally when I use your basic code you have posted up there and put this code in it it breaks... with following error:

OpenCV Error: Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= oi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in cv::Mat::Mat, file C:\builds\master_PackSlave-in32-vc12-shared\opencv\modules\core\src\matrix.cpp, line 492
2015-06-03 14:12:47 -0600 commented answer Line segment detection Near horizontal

I thought next piece of code was going to do the trick :( ... but it gives exception ...

vector<Vec4i> rectangleHierarchy;
std::vector<std::vector<cv::Point> > rectangleContours;
Mat roi(rsz, boundRect[i]);
cv::findContours(roi, rectangleContours, rectangleHierarchy, cv::RETR_CCOMP, cv::CHAIN_APPROX_SIMPLE, Point(0, 0));
if (rectangleContours.size() != 0){
    cout << "Rectangle has no song number!" << roi << endl;
}
else{
    cout << "Ah Rectangle" << roi << endl;
}

Which I will put at the end of this for:

for (size_t i = 0; i < contours.size(); i++)
{
    //        cout << boundRect[i].tl() << endl;
    //        cout << boundRect[i].br() << endl << endl;

    //        cout << arcLength(cv::Mat(contours[i]), true) << endl;
    double length = arcLength(cv::Mat(contours[i]), true
2015-05-30 09:14:00 -0600 answered a question Line segment detection Near horizontal

@theodore Hi (i'm happyforce but I was not able to log in with my previous account since it used (google button))

I have just 1 question left my program is nearly finished I only need to know 1 thing.

I have the rectangles which would cover the song numbers (green in the picture you showed) . I need to be able to check if there is something in the box. As it happens sometimes there are lines too much at the end of the pages. For example:

image description : you can see at the end of a column we have a line and at the start of the next column we have another line. I need to be able to filter these situations so I was thinking I can checke whether the song number is there or not.

So in short:

I need a function/ functions to check if a rectangle is empty on the given file.

As it seems simple I have not found an example yet.