Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Out of range exception happens when using an aruco board and a marker at the same time. #24

Open
johanos opened this issue Mar 14, 2019 · 1 comment
Labels

Comments

@johanos
Copy link

johanos commented Mar 14, 2019

Hi! awesome work here

I've been using it but it seems that when you have an aruco board being detected and an aruco marker at the same time, if you move the markers quickly or have one occlude the other. it will cause an out of bounds exception in the c++ code and hard crash Unity.

I tested this by building your source as well and the issue is presented there as well, and in the Tracking Example I set up 2 markers ( id 49 and id 1) to be tracked. and I set up a 7x5 Aruco board. I then quickly shook the board and markers to make them tracked and not tracked as well as put one in front of the other etc...

I tried my best to look into it but I wasn't entirely sure about how the project was laid out. I did find some things that might help you figure out the issue.

More specifically it looks like in vector_vec3d.cpp you have

try {
    element = &(vector->at(pos));
} catch (cv::Exception& e){...}

but the position pos is usually greater than vector.size(); when the exception occurs... Since its a std exception and not an openCV exception it will not get caught. However, it still crashes when adding a std::exception catch statement there because it might be returning a null pointer to wherever this result gets used.

Additionally

the functions in vector_vec3d.cpp get called in VectorVec3d.cs I tried looking into it but I couldn't figure out why it was breaking since it also crashes unity as soon as it hits here. However; I think I narrowed it down to the function public Cv.Vec3d At(uint pos) being the entry point into the error. I think when it is used in the UpdateTransforms cycle you have it tried to access a point in a vector that doesn't exist.

Also: I'm on windows using Unity 2018.3.0f2 and OpenCV from your CMake file
Let me know if someone already brought this issue up!
Thanks.

@NormandErwan
Copy link
Owner

Hi!

Apologies for my very late answer!

Thank you for your detailed feedback! I'll try to reproduce the issue.

However, I can already remove the useless catch (cv::Exception& e) for bindings on the std lib. Thank you for pinpointing that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants