std::vector corrupted when calling HOGDescriptor::compute

asked 2017-05-18 09:51:22 -0500

ziggy gravatar image

The length of both std::vectors passed to HOGDescriptor::compute are changing their size to a random value when passed in to openCV. Of course the actually amount of memory allocated doesn't change, causing memory access violations.

I've worked around this by adding a wrapper function to HOGDescriptor::compute that copies the std::vector descriptors to a cv::Mat and removes the optional locations parameter.

Questions:

1) Any ideas why this is happening?

2) A quick google shows other have had this issue, should exposing std containers be avoided? (I don't know too much about this but have heard it is bad)

Running: Windows 10, Visual studio 2015 built opencv_world310.dll by me. Both the dll and my application are build using the visual studio 2015 tool chain on the same machine.

edit retag flag offensive close merge delete