Eigenface Recognition Using Emgucv Help!

jriz25

New member
Joined
Feb 16, 2014
Messages
1
Programming Experience
Beginner
hi im a beginner programmer using EmguCV Eigenface Recognition.
i have a problem with recognizing the image in my database. as i press the recognized button an error occurs.
it says: "IndexOutOfRangeException was unhandled; index was outside the bounds of array "

here is the code:

Dim imagelist(table.Rows.Count - 1) As Image(Of Gray, Byte)
Dim labellist(table.Rows.Count - 1) As String

For a = 0 To table.Rows.Count - 1
Dim tempimage As Bitmap
tempimage = table.Rows(a).Item("Image")
imagelist(a) = New Image(Of Gray, Byte)(tempimage)
labellist(a) = table.Rows(a).Item("Last_Name")


Next
Dim TermCrit As MCvTermCriteria = New MCvTermCriteria(16, 0.001)
Dim maxdistance As Integer = 5000
Dim EobjectRec As EigenObjectRecognizer

EobjectRec = New EigenObjectRecognizer(imagelist, labellist, maxdistance, TermCrit) <-------here is the error occuring

Try
TextBox1.Text = EobjectRec.Recognize(images).Label
Catch ex As Exception

MsgBox("No Saved Image")

End Try

End Sub

--------------

what will i do next?
please really need help.!!!!!
asap. thank you
 
Firstly, you've messed up your code formatting and you've also made it so that I can't fix it. For future reference, please post code snippets as plain text inside code formatting tags and let them take care of all the formatting. For example, this:

[xcode=vb]Dim n As Integer = 100[/xcode]

produces this:

Dim n As Integer = 100


If you want to highlight something specific then you can use something like this:

[code]Dim n [B][U][COLOR="#FF0000"]As Integer[/COLOR][/U][/B] = 100[/code]

to produce this:

VB.NET:
Dim n [B][U][COLOR="#FF0000"]As Integer[/COLOR][/U][/B] = 100

As for your question, as far as I can see, there is no index being used on that specific line of code. That would suggest that the exception is being thrown inside the third-party library as a result of the data that you have passed in. You should start by examining the stack trace of the exception to see exactly where the exception is being thrown. You then need to analyse the values that you're passing in to determine which one is being indexed and/or which one is being used as an index and determine why the index is invalid. Remember that if you have an array or collection with N items then any value less than zero or greater than (N-1) will be an invalid index and cause that exception to be thrown.
 
Back
Top