OpenCV cvPOSIT(...)

i call the posit algorithm of the opencv library like it is explained in the example on their website and it works perfectly fine:
cvPOSIT(PositObject, &ImagePoints[0], Focal_Length, Criteria, Rot_Mat, Trans_Vec);

before posit i use puchback to save the calculated imagepoints:
1
2
3
4
ImagePoints.push_back(marker1);
ImagePoints.push_back(marker2);
ImagePoints.push_back(marker3);
ImagePoints.push_back(marker4);


but since this vector never gets erases i can only use it for 1 calculation.
so i added an erase command before i push-back the values:
1
2
3
4
5
ImagePoints.erase(ImagePoints.begin(), ImagePoints.end());
ImagePoints.push_back(marker1);
ImagePoints.push_back(marker2);
ImagePoints.push_back(marker3);
ImagePoints.push_back(marker4);

This works fine for the first calculation, but for any further calculation i get NaN as a result.
I checked ImagePoints in the debugger and it has 4 entries, each containing a x and a y coordinate, so erase and pushback is also working fine.

I'm pretty sure its not my code, so in case anyone ever had the same problem, please let me know if you solved it and and how. also post your ideas if i could try anything besides erase or overwritting the entries with [0] to [3] as index.



Edit: stupid mistake is stupid: used the same image twice, so i didnt see a change. thought it only works once since i pass &ImagePoints[0].
guess Posit counts the number is was called, thats why erase makin problems.
Last edited on
I suggest you look for an OpenCV forum or email list.
ImagePoints must be an OpenCV data type, and there
are people in that community who can tell you how to
use it, or point you to documentation.

Good luck!
Topic archived. No new replies allowed.