Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
In this code I am getting the error :
C#
CS0246	The type or namespace name 'Matrix<float>' could not be found (are you missing a using directive or an assembly reference?)


C#
#region Generate the training data and classes

Matrix<float> trainData = new Matrix<float>(trainSampleCount, 2);
Matrix<float> trainClasses = new Matrix<float>(trainSampleCount, 1);

Image<Bgr, Byte> img = new Image<Bgr, byte>(500, 500);

Matrix<float> sample = new Matrix<float>(1, 2);

Matrix<float> trainData1 = trainData.GetRows(0, trainSampleCount / 3, 1);
trainData1.GetCols(0, 1).SetRandNormal(new MCvScalar(100), new MCvScalar(sigma));
trainData1.GetCols(1, 2).SetRandNormal(new MCvScalar(300), new MCvScalar(sigma));

Matrix<float> trainData2 = trainData.GetRows(trainSampleCount / 3, 2 * trainSampleCount / 3, 1);
trainData2.SetRandNormal(new MCvScalar(400), new MCvScalar(sigma));

Matrix<float> trainData3 = trainData.GetRows(2 * trainSampleCount / 3, trainSampleCount, 1);
trainData3.GetCols(0, 1).SetRandNormal(new MCvScalar(300), new MCvScalar(sigma));
trainData3.GetCols(1, 2).SetRandNormal(new MCvScalar(100), new MCvScalar(sigma));

Matrix<float> trainClasses1 = trainClasses.GetRows(0, trainSampleCount / 3, 1);
trainClasses1.SetValue(1);
Matrix<float> trainClasses2 = trainClasses.GetRows(trainSampleCount / 3, 2 * trainSampleCount / 3, 1);
trainClasses2.SetValue(2);
Matrix<float> trainClasses3 = trainClasses.GetRows(2 * trainSampleCount / 3, trainSampleCount, 1);
trainClasses3.SetValue(3);

#endregion


How can I resolve it ?

What I have tried:

I am trying SVM (Support vector machine) for object classification which uses these libraries. Can anyone provide the alternate source code for SVM
Posted
Updated 19-Mar-16 22:27pm
Comments
[no name] 19-Mar-16 16:25pm    
VS is usually very helpfull. Read the message "are you missing a using directive or an assembly reference?)" and more VS helps you on things like this by right click the message. Than it gives you sometimes the Option to solve it.

"provide the alternate source code for SVM": Do you think this really helps?
Suvendu Shekhar Giri 19-Mar-16 16:31pm    
agree. should help OP.
[no name] 19-Mar-16 17:03pm    
Thank you. Bruno
[no name] 19-Mar-16 20:59pm    
It seems you missing reference to an assembly or using directive. Please check for the namspaces
KittoKy 24-Mar-16 4:09am    
yes I clicked the link and it also suggested me to add some reference. But which namespace or using directive shall I add OR for VS2010 which reference and for VS2015 which NuGet Package to install ?

1 solution

 
Share this answer
 
Comments
KittoKy 24-Mar-16 4:11am    
That's what I am trying to ask Richard MacCutchan which namespace or using directive shall I add OR for VS2010 which reference and for VS2015 which NuGet Package to install ?

Or could anyone give me a link for any online documentation for that?
Richard MacCutchan 24-Mar-16 5:01am    
Why not read the documentation? And please make the effort to search Google for the links yourself.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900