Mat::operator() throwing exception

asked 2014-01-16 20:09:43 -0600

timpattinson gravatar image

I have this code, to take a quadrant of the image. In the documentation for cv::Rect it says that rect.x and rect.y refer to the upper left corner, however that seems not to be the case. I'm using VS2012 and opencv version 2.4.6

_declspec(dllexport) video::video_error_t video::subsectionFilter::ProcessFrame(Mat &frame)
{
    Mat subsct;
    if(bQuadrant){
        switch(iQuadrant)
        {
            case topright:
                roi.x = frame.cols/2;
                roi.y =frame.rows;
                break;
            case topleft:
                roi.x = 0;
                roi.y = frame.rows;
                break;
            case bottomleft:
                roi.x = 0;
                roi.y = frame.rows/2;
                break;
            case bottomright:
                roi.x = frame.cols/2;
                roi.y = frame.rows/2;
                break;
        }
        roi.width=frame.cols/2;
        roi.height=frame.rows/2;
    }
    subsct = frame(roi);
    frame = subsct;
    return success;
}
edit retag flag offensive close merge delete