Пример #1
0
        private void rbnDDBtnSearch_MenuItemClick(object sender, PureComponents.ActionSet.RibbonUI.RibbonMenuItemEventArgs e)
        {
            try
            {
                if (e.MenuItem.Text == "Search by Example")
                {
                    this.Cursor = Cursors.WaitCursor;
                    if ((picExample.ImageLocation == null) || (picExample.ImageLocation == ""))
                    {
                        throw new Exception("Please open an example image to find similar images !");
                    }
                    picLstResults.Items.Clear();
                    search srch = new search();
                    //long ll = DateTime.Now.Ticks;
                    List <string[]> res = srch.SearchByExample(picExample.ImageLocation, DBC,
                                                               double.Parse(rbnTxtMaxArea.Text), double.Parse(rbnTxtMinArea.Text));
                    if (res == null)
                    {
                        throw new Exception("An error occured !\nThe database is empty or there are no matches !");
                    }
                    for (int i = 0; i < res.Count; i++)
                    {
                        string name = res[i][0];

                        string imgpath = SC.SettingsList[0].Trim('\\') + "\\" + res[i][1] + "\\" + res[i][0];

                        Bitmap bmp = new Bitmap(imgpath);
                        PureComponents.EntrySet.Lists.PictureListItem pItem =
                            new PureComponents.EntrySet.Lists.PictureListItem(name + res[i][2],
                                                                              bmp, true, null);
                        pItem.Tag   = imgpath;
                        pItem.Value = res[i][3];
                        picLstResults.Items.Add(pItem);
                    }
                    rbnMain.StatusBar.Text =
                        rbnMain.StatusBar.Text.Remove(rbnMain.StatusBar.Text.IndexOf("."));
                    rbnMain.StatusBar.Text = rbnMain.StatusBar.Text + ". Number of results is " + res.Count;
                    //ll = DateTime.Now.Ticks - ll;
                    //ll = ll / 1000;
                    //ll = ll / 3600;
                    //MessageBox.Show(ll.ToString());
                    this.Cursor = Cursors.Default;
                }
                else
                {
                    MessageBox.Show("Search by semantic is not activated !");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Searching Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Cursor = Cursors.Default;
            }
        }
Пример #2
0
 private void rbnMain_RibbonApplicationMenuItemClick(object sender, PureComponents.ActionSet.RibbonUI.RibbonMenuItemEventArgs e)
 {
     if (e.MenuItem == rbnMnuItmBrowse)
     {
         if (DBC.IsConnected)
         {
             picLstResults.Items.Clear();
             viewAllImages();
         }
     }
     else if (e.MenuItem == rbnMnuItmHelp)
     {
         System.Diagnostics.Process.Start("XCBIR Help.chm");
     }
     else if (e.MenuItem == rbnMnuItmAbout)
     {
         MessageBox.Show(
             "University of Kalamoon\nInformation Technology\nGraduation Project\nX-CBIR 2009\nAhmad Hajjar - Osama Al-Khatib",
             "About", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }