{"action":"created","issue":{"url":"https://api.github.com/repos/shimat/opencvsharp/issues/176","labels_url":"https://api.github.com/repos/shimat/opencvsharp/issues/176/labels{/name}","comments_url":"https://api.github.com/repos/shimat/opencvsharp/issues/176/comments","events_url":"https://api.github.com/repos/shimat/opencvsharp/issues/176/events","html_url":"https://github.com/shimat/opencvsharp/issues/176","id":130425164,"number":176,"title":"FindHomography when keypoint lengths don't match","user":{"login":"fdncred","id":343840,"avatar_url":"https://avatars.githubusercontent.com/u/343840?v=3","gravatar_id":"","url":"https://api.github.com/users/fdncred","html_url":"https://github.com/fdncred","followers_url":"https://api.github.com/users/fdncred/followers","following_url":"https://api.github.com/users/fdncred/following{/other_user}","gists_url":"https://api.github.com/users/fdncred/gists{/gist_id}","starred_url":"https://api.github.com/users/fdncred/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fdncred/subscriptions","organizations_url":"https://api.github.com/users/fdncred/orgs","repos_url":"https://api.github.com/users/fdncred/repos","events_url":"https://api.github.com/users/fdncred/events{/privacy}","received_events_url":"https://api.github.com/users/fdncred/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/shimat/opencvsharp/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/shimat/opencvsharp/labels/enhancement","name":"enhancement","color":"207de5"},{"url":"https://api.github.com/repos/shimat/opencvsharp/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2016-02-01T17:23:39Z","updated_at":"2016-02-02T15:38:59Z","closed_at":null,"body":"@shimat I'm having a hard time figuring out how to port an old Emgu function to OpenCvSharp.  The problem is with FindHomography expecting the first two arguments to be the exact same length.\r\n\r\n```c#\r\npublic static Point2d Point2fToPoint2d(Point2f pf) => new Point2d(((int)pf.X), ((int)pf.Y));\r\n\r\nstatic void RunKaze()\r\n{\r\n    using (var img0 = new Mat(\"1824_ALNT_11839P_005_00000087.jpg\"))\r\n    using (var img1 = new Mat(\"1824_ALNT_11839P_009_00000089.jpg\"))\r\n    using (var descriptors0 = new Mat())\r\n    using (var descriptors1 = new Mat())\r\n    using (var bfMatcher = new BFMatcher(NormTypes.L2SQR))\r\n    using (var flannMatcher = new FlannBasedMatcher())\r\n    using (var kaze = KAZE.Create())\r\n    {\r\n        KeyPoint[] kp0, kp1;\r\n        kaze.DetectAndCompute(img0, null, out kp0, descriptors0);\r\n        kaze.DetectAndCompute(img1, null, out kp1, descriptors1);\r\n\r\n        List<Point2d> kp0Pt = (from item in kp0 select item.Pt).ToList().ConvertAll(new Converter<Point2f, Point2d>(Point2fToPoint2d));\r\n        List<Point2d> kp1Pt = (from item in kp1 select item.Pt).ToList().ConvertAll(new Converter<Point2f, Point2d>(Point2fToPoint2d));\r\n\r\n        DMatch[][] dMatches = bfMatcher.KnnMatch(descriptors0, descriptors1, 2);\r\n        using (var mask = new Mat(dMatches.Length, 1, MatType.CV_8U))\r\n        {\r\n            mask.SetTo(new Scalar(255));\r\n            int nonZero = Cv2.CountNonZero(mask);\r\n            VoteForUniqueness(dMatches, mask);\r\n            nonZero = Cv2.CountNonZero(mask);\r\n            VoteForSizeAndOrientation(kp1, kp0, dMatches, mask, 1.5f, 20);\r\n            nonZero = Cv2.CountNonZero(mask);\r\n            if (nonZero >=4)\r\n            {\r\n                Mat homography = Cv2.FindHomography(kp1Pt, kp0Pt, HomographyMethods.Ransac, 1.5, mask);\r\n                nonZero = Cv2.CountNonZero(mask);\r\n            }\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nMy VoteForUniqueness() and VoteForSizeAndOrientation() seem to be working but when it comes time to make the Homography it blows up because kp1Pt and kp0Pt have two different lengths.  Any ideas how to overcome this?"},"comment":{"url":"https://api.github.com/repos/shimat/opencvsharp/issues/comments/178642326","html_url":"https://github.com/shimat/opencvsharp/issues/176#issuecomment-178642326","issue_url":"https://api.github.com/repos/shimat/opencvsharp/issues/176","id":178642326,"user":{"login":"fdncred","id":343840,"avatar_url":"https://avatars.githubusercontent.com/u/343840?v=3","gravatar_id":"","url":"https://api.github.com/users/fdncred","html_url":"https://github.com/fdncred","followers_url":"https://api.github.com/users/fdncred/followers","following_url":"https://api.github.com/users/fdncred/following{/other_user}","gists_url":"https://api.github.com/users/fdncred/gists{/gist_id}","starred_url":"https://api.github.com/users/fdncred/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fdncred/subscriptions","organizations_url":"https://api.github.com/users/fdncred/orgs","repos_url":"https://api.github.com/users/fdncred/repos","events_url":"https://api.github.com/users/fdncred/events{/privacy}","received_events_url":"https://api.github.com/users/fdncred/received_events","type":"User","site_admin":false},"created_at":"2016-02-02T15:38:59Z","updated_at":"2016-02-02T15:38:59Z","body":"@shimat I also think MatOfByte3 may have a similar bug.\r\nhttps://github.com/shimat/opencvsharp/blob/master/src/OpenCvSharp/modules/core/Mat/MatOfByte3.cs#L14"}}