SaneeshTG / accord

Automatically exported from code.google.com/p/accord
0 stars 0 forks source link

KNearestNeighborMatching<byte[]> matcher throws exeption when first array has just one element #49

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I've already tried to submit issue but seems like it was timeout, so - once 
again:

1. corner detector type - FastCornersDetector
2. feature detector type - FastRetinaKeypointDetector
3. point matcher type - KNearestNeighborMatching<byte[]>(2, 
Distance.BitwiseHamming)

a bit of code:

cornerDetector.Threshold = 18;
List<FastRetinaKeypoint> descriptors = freakDetector.ProcessImage(newImage);
var union1 = descriptors.ToArray(); // length == 2, got it from newImage 
(attached)
var union2 = lastFeaturePoints1; // length == 1, got it from oldImage (attached)
var knMatches = matcher.Match(union2, union1); // exception here

Exception details:
System.IndexOutOfRangeException was unhandled by user code
  HResult=-2146233080
  Message=Index was outside the bounds of the array.
  Source=Accord.Math
  StackTrace:
       at Accord.Math.Matrix.Bottom[T](T[] values, Int32 count, Boolean inPlace) in C:\Work\Accord.NET\Sources\Accord.Math\Matrix\Matrix.Selection.cs:line 1657
       at Accord.MachineLearning.KNearestNeighbors`1.Compute(T input, Double[]& scores) in C:\Work\Accord.NET\Sources\Accord.MachineLearning\KNearestNeighbors`1.cs:line 326
       at Accord.MachineLearning.KNearestNeighbors`1.Compute(T input, Double& response) in C:\Work\Accord.NET\Sources\Accord.MachineLearning\KNearestNeighbors`1.cs:line 305
       at Accord.Imaging.KNearestNeighborMatching`1.Match(IFeaturePoint`1[] points1, IFeaturePoint`1[] points2) in C:\Work\Accord.NET\Sources\Accord.Imaging\KNearestNeighborMatching.cs:line 128
       at Exonya.EdgeDetector.Accord.MainWindow.ProcessImageFREAK(UnmanagedImage rgbImage) in c:\Work\Exonya.EdgeDetector1\Exonya.EdgeDetector.Accord\MainWindow.xaml.cs:line 274
       at Exonya.EdgeDetector.Accord.MainWindow.video_NewFrame(Object sender, NewFrameEventArgs eventArgs) in c:\Work\Exonya.EdgeDetector1\Exonya.EdgeDetector.Accord\MainWindow.xaml.cs:line 130
       at AForge.Video.DirectShow.VideoCaptureDevice.OnNewFrame(Bitmap image)
       at AForge.Video.DirectShow.VideoCaptureDevice.Grabber.BufferCB(Double sampleTime, IntPtr buffer, Int32 bufferLen)
  InnerException: 

Windows 7, Accord.NET 2.9.0.0

thanks

Original issue reported on code.google.com by magic...@gmail.com on 17 May 2013 at 10:12

Attachments:

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r556.

Original comment by cesarso...@gmail.com on 1 Jun 2013 at 10:36