1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
// Create 2 tables for each descriptor. In the first Table you
// keep information about "Source Image" (initial image) and in the second table
// you keep information about "To Compare" image
// SOS in this version we do not use multiple threads
panel1.Visible = true;
panel1.Refresh();
Setlabels("Reading Image", "Please Wait");
CEDD_Descriptor.CEDD CEDDDescriptor = new CEDD_Descriptor.CEDD(); // using CEDD.DLL
double[] CEDDTable_Source = new double[144];
double[] CEDDTable_ToCompare = new double[144];
int Descriptor = 0;
// Get the descriptor for the source image
CEDDTable_Source = CEDDDescriptor.Apply(SourceImage); // GET The CEDD Descriptor for the Initial Image
// Ok, now you have the descriptor for the images.
// Remember that you can save the descripors for all the images in one XLM type file
// You can use the Img(Rummager) "manage data" to create these files and then search using these files in order to increase the searching speed
int NumberOfImages = Convert.ToInt32(textBox18.Text.ToString());
double TotalDeviation = 0; // Here you will store the deviation of the images (pairwise)
Bitmap ToCompare;
MPEG_7Simillarity MPEGComparer = new MPEG_7Simillarity(); // Use this class in order to campare images using MPEG-7 Descriptors
DataResults.Clear(); // Clear the results
for (int i = 0; i < NumberOfImages; i++)
{
ToCompare = new Bitmap(ImagesToSearch[i].ToString());
Setlabels("Checking CEDD (3-bit) Similarity", "So Far Results: " + i.ToString());
CEDDTable_ToCompare = CEDDDescriptor.Apply(ToCompare);
TotalDeviation = TanimotoClassifier(CEDDTable_ToCompare, CEDDTable_Source); // We are Using Tanimoto in order to Compare Images
DataResults.Rows.Add(ImagesToSearch[i].ToString(), TotalDeviation);
}
// Show The Results and Sort them
dataGrid4.DataSource = DataResults;
dataGrid4.ReadOnly = false;
dataGrid4.Columns[1].ReadOnly = true;
dataGrid4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
dataGrid4.Columns[1].Width = 20;
dataGrid4.Columns[0].Width = 160;
int thirdColumn = 1;
DataGridViewColumn column = dataGrid4.Columns[thirdColumn];
dataGrid4.Sort(column, (ListSortDirection)0);
dataGrid4.ReadOnly = true;
if (dataGrid4.Rows.Count > 1)
{
dataGrid4[0, 0].Selected = true;
PreviewResults();
}
panel1.Visible = false;
panel1.Refresh(); |
Partager