2013-04-10 02:37:58 -0600
| answered a question | SURF matching against a database of images Hi again:
If i change //At this point, we should to build the index of the big matrix
Index fln = new Index(supermatrix, 4);
//Retrieve The Rows supermatrix
Matrix<int> indices = new Matrix<int>(supermatrix.Rows, k);
Matrix<float> dist = new Matrix<float>(supermatrix.Rows, k);
fln.KnnSearch(observedDescriptors, indices, dist, k, 12);
to //At this point, we should to build the index of the big matrix
Index fln = new Index(observedDescriptors, 4);
//Retrieve The Rows supermatrix
Matrix<int> indices = new Matrix<int>(supermatrix.Rows, k);
Matrix<float> dist = new Matrix<float>(supermatrix.Rows, k);
fln.KnnSearch(supermatrix, indices, dist, k, 20);
I think that this line it's incorrect, i think that the index should be built with supermatrix Index fln = new Index(observedDescriptors, 4); //What it's the correct line?
Index fln = new Index(supermatrix, 4);
Indices and dist have values but the following code has output many rare values: for (int i = 0; i < indices.Rows; i++){
if (dist.Data[i, 0] < 0.8 * dist.Data[i, 1]){
Debug.WriteLine("This Point Is Good");
Debug.WriteLine("The image most similar is" + i);
}
}
This Point Is Good
The image most similar is11
This Point Is Good
The image most similar is12
This Point Is Good
The image most similar is25
This Point Is Good
The image most similar is27
This Point Is Good
The image most similar is30
This Point Is Good
The image most similar is31
................................
................................
All points in dist are similar?
I think that i have a big error in the code. |
2013-04-09 16:35:15 -0600
| answered a question | SURF matching against a database of images I modified the code but i have retrieve the same result.
Indices and dist are always contains 0 values
in The system never executed the line " Debug.WriteLine("This Point Is Good");
I will be very gratefull if anyone could to fix my code.
I am very lost with knntree examples.
The second version of the code with the Guanta fix is: SURFDetector surfCPU = new SURFDetector(50, false);
Matrix<float> matrix,supermatrix;
VectorOfKeyPoint observedKeyPoints, modelKeyPoints;
Image<Gray, byte> observedImage, modelImage;
int k = 2;
private void Pruebas(){
//Load Image To Compare With ALL Images in Database
observedImage = new Image<Gray, byte>(@"C:\Users\gabri_000\Pictures\uneuro.png");
observedKeyPoints = surfCPU.DetectKeyPointsRaw(observedImage, null);
Matrix<float> observedDescriptors = surfCPU.ComputeDescriptorsRaw(observedImage, null, observedKeyPoints);
//Path With ALL Images Database
//We will to build the big index for use with flann algorithm
string[] images = Directory.GetFiles(@"C:\Users\gabri_000\Pictures", "*.png");
foreach (string image in images)
{
DateTime start = DateTime.Now;
Debug.WriteLine("Current Image " + image);
modelImage = new Image<Gray, byte>(image);
modelKeyPoints = surfCPU.DetectKeyPointsRaw(modelImage, null);
matrix = surfCPU.ComputeDescriptorsRaw(modelImage, null, modelKeyPoints);
if (supermatrix == null)
{
supermatrix = new Matrix<float>(matrix.Rows, matrix.Cols);
supermatrix = matrix;
}
else
{
supermatrix= supermatrix.ConcateVertical(matrix);
}
DateTime end = DateTime.Now;
Debug.WriteLine("Process Time " + (end - start));
}
//At this point, we should to build the index of the big matrix
Index fln = new Index(supermatrix, 4);
//Retrieve The Rows supermatrix
Matrix<int> indices = new Matrix<int>(supermatrix.Rows, k);
Matrix<float> dist = new Matrix<float>(supermatrix.Rows, k);
fln.KnnSearch(observedDescriptors, indices, dist, k, 12);
Debug.WriteLine("-----------------------");
for (int i = 0; i < indices.Size.Height; i++)
{
if (dist.Data[i, 0] < 0.6 * dist.Data[i, 1])
{
Debug.WriteLine("This Point Is Good");
Debug.WriteLine("The image most similar is" + i);
}
}
}
|
2013-04-09 15:26:22 -0600
| answered a question | SURF matching against a database of images Hi Ganga, thanks for you quickly answer , i have a problem with the Matrix,
supermatrix is a list of matrix. Can i convert List<matrix> to Matrix? How each image has a different matrix, i don't know how to concatenate all, and i tried this:
//Can i do this? I don't know how to concatenate Matrix var, i am storing all matrix in a list
supermatrix.Add(matrix); |
2013-04-09 14:48:46 -0600
| received badge | ● Editor
(source)
|
2013-04-09 14:43:39 -0600
| answered a question | SURF matching against a database of images Hi people i am trying to develop the solution mentioned here.
My problem is after this line: fln.KnnSearch(observedDescriptors, indices, dist, k, 12);
This line is never showed "Debug.WriteLine("This Point Is Good");
Thanks to all private void Pruebas(){
//Load Image To Compare With ALL Images in Database
Image<Gray, byte> observedImage = new Image<Gray, byte>(@"C:\Users\gabri_000\Pictures\uneuro.png");
VectorOfKeyPoint observedKeyPoints = surfCPU.DetectKeyPointsRaw(observedImage, null);
Matrix<float> observedDescriptors = surfCPU.ComputeDescriptorsRaw(observedImage, null, observedKeyPoints);
//Path With ALL Images Database
//We will to build the big index for use with flann algorithm
string[] images = Directory.GetFiles(@"C:\Users\gabri_000\Pictures", "*.png");
foreach (string image in images)
{
DateTime start = DateTime.Now;
Debug.WriteLine("Current Image " + image);
Image<Gray, byte> observedimage = new Image<Gray, byte>(image);
observedKeyPoints = surfCPU.DetectKeyPointsRaw(observedimage, null);
matrix = surfCPU.ComputeDescriptorsRaw(observedimage, null, observedKeyPoints);
//Can i do this? I don't know how to concatenate Matrix var, i am storing all matrix in a list
supermatrix.Add(matrix);
DateTime end = DateTime.Now;
Debug.WriteLine("Process Time " + (end - start));
}
//At this point, we should to build the index of the big matrix
Index fln = new Index(matrix, 4);
//Retrieve The Rows supermatrix
int supermatrixrows = 0;
for (int i = 0; i < supermatrix.Count(); i++)
supermatrixrows = supermatrixrows + supermatrix[i].Rows;
Matrix<int> indices = new Matrix<int>(supermatrixrows, k);
Matrix<float> dist = new Matrix<float>(supermatrixrows, k);
fln.KnnSearch(observedDescriptors, indices, dist, k, 12);
Debug.WriteLine("-----------------------");
for (int i = 0; i < indices.Size.Height; i++)
{
if (dist.Data[i, 0] < 0.6 * dist.Data[i, 1])
{
Debug.WriteLine("This Point Is Good");
}
}
}
|
2013-04-09 04:08:43 -0600
| answered a question | SURF matching against a database of images I have one question about the code:
When you built the big matrix, and built the index.
How I can retrieve the image most similar?
Whis this line?
fln.KnnSearch(supermatrix, indices,dist, k,12); |
2013-04-09 02:58:23 -0600
| answered a question | SURF matching against a database of images hjf, did you finish the code? Can you share a new version?
I am very interested, i am trying the same thing as you, but i can't retrieve a good result
I am reading on internet and i saw your code!!
Thanks i hope your answer |