Ask Your Question
0

Error assertion roi failed

asked 2016-04-13 16:16:28 -0500

marcob88 gravatar image

I have an image 640x480 and i need to extract a submatrix with this roi: x="216" y="107" width="423" height="255". I try to this:

    Mat frame = imread(path + fileName);
        vector<KeyPoint> keyPoint = vector<KeyPoint>();
        if (!frame.empty())
        {
            //prendo il punto del frame dell'evento interessato
            int width = itc->width;
            int height = itc->height;
            int x = itc->x;
            int y = itc->y;

            Mat bbox = Mat(frame,Rect(itc->x, itc->y, itc->x + itc->width, itc->y + itc->height));

but i have this exception :

Assertion Failed: 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows

where is the error? can you help me?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2016-04-13 16:33:41 -0500

did you try

Mat bbox = Mat(frame,Rect(itc->x, itc->y, itc->width, itc->height)
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-04-13 16:16:28 -0500

Seen: 579 times

Last updated: Apr 13 '16