Ask Your Question
0

Get coordinates from the detected object using haar cascade (c++)

asked 2018-02-09 10:44:47 -0600

Im working my image processing in c++, and Im using the method of haar cascade. And I got the object detected, but my problem is, the detected object is stored in Vector<rect>. I do understand to get a coordinate using find contours, but if the object is in Mat and it is 8 bit. But I dont understand how to convert Vector<rect> to Mat. Or if you guys have another way to get the coordinate. I hope that it is clear enough. Thank you

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2018-02-09 11:26:00 -0600

LBerger gravatar image

Convert rect to Mat :

    vector<Rect> x;
    x.push_back(Rect(0, 0, 1, 1));
    x.push_back(Rect(2, 2, 1, 1));
    x.push_back(Rect(3, 3, 1, 1));
    Mat w(x);
    cout << w << "\n";

results are :

[0, 0, 1, 1;
 2, 2, 1, 1;
 3, 3, 1, 1]
edit flag offensive delete link more

Comments

Thank you sir for answering, but I still confused of the (0, 0, 1, 1), (2, 2, 1, 1), and (3, 3, 1, 1). What is those number ? Should I just use all those numbers. Because my vector<rect> has the value itself and I want to convert it to mat.

Fortunejr gravatar imageFortunejr ( 2018-02-09 18:01:14 -0600 )edit
LBerger gravatar imageLBerger ( 2018-02-10 00:07:58 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-02-09 10:44:47 -0600

Seen: 438 times

Last updated: Feb 09 '18