Praj
March 12, 2017, 10:48pm
1
Hey CD,
I am working on calculating the centerX for gear vision tracking.
I want 2 separate rect objects with each vision rectangle.
I found this in java.
Rect rect1 = Imgproc.boundingRect(contours.get(1));
On C++ I can not find any functions for .get.
The contours are stored in a vector in C++, so you can just access them with normal index notation, i.e. [1].
Praj
March 12, 2017, 11:14pm
3
So,
boundingRect r1 = contours(0);?
I tried doing this with a mat object but got a openCV assertion failed error. I think it was because I tried inputting a Mat instead of a vector point object. Would I need to put or change the syntax?
Praj
March 12, 2017, 11:55pm
4
I get this error
assertion failure (points.checkVector(2) >= 0 && (points.depth() == CV_23F || points.depth() == CV_32S)) in cv::boundingRect...).
From what I have researched, apparently there is an uninitialized variable.
Something like this should work:
Rect r = boundingRect(contours[0]);