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

fix TrackerKCF.Update crash #500

Merged
merged 1 commit into from
Jun 5, 2018

Conversation

t-yuki
Copy link
Contributor

@t-yuki t-yuki commented May 25, 2018

Related to #459 but another problem, I caught OpenCvSharp.OpenCVException from OpenCvSharp.Tracking.Tracker.Update method with TrackerKCF that was created with custom tracker parameter.

OpenCvSharp.OpenCVException: type == (((6) & ((1 << 3) - 1)) + (((2)-1) << 3))
 OpenCvSharp.NativeMethods.<>c.<.cctor>b__1581_0(ErrorCode status, String funcName, String errMsg, String fileName, Int32 line, IntPtr userdata)
 OpenCvSharp.NativeMethods.tracking_Tracker_update(IntPtr obj, IntPtr image, Rect2d& boundingBox)
 OpenCvSharp.Tracking.Tracker.Update(Mat image, Rect2d& boundingBox)

It was not happened on openCVSharp 3.3.1.20171117 but after upgrade to 3.4.1.20180319, that method always throw exceptions.

After several investigations, I found that TrackerKCF.Params struct has mismatched layout.
Layout attribute [MarshalAs(UnmanagedType.Bool)] means marshal as BOOL, which is actually int in Win32, but the corresponding struct field in OpenCV was bool.
So let's use UnmanagedType.U1.

@shimat
Copy link
Owner

shimat commented Jun 5, 2018

Sorry for the late reply🙇‍♀️Thanks!

@shimat shimat merged commit a0d6106 into shimat:master Jun 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants