Esempio n. 1
0
        //图片无参考排序
        private void imageSort_none_Click(object sender, EventArgs e)
        {
            resetSortPanel();
            this.Refresh();
            progress = 0;
            Thread progressThread = new Thread(progress_thread);

            progressThread.IsBackground = true;
            progressThread.Start();
            sortObject[] sortArray = new sortObject[tot];
            for (int i = 0; i < tot; i++)
            {
                name_copy[i]      = name[i];
                path_name_copy[i] = path_name[i];
                if (!picInfo[path_name[i]].state_none)
                {
                    picInfo[path_name[i]].grade_none = picInfo[path_name[i]].tenengrad();
                    picInfo[path_name[i]].state_none = true;
                }
                sortArray[i] = new sortObject(picInfo[path_name[i]].grade_none, path_name[i], name[i]);
                progress     = 950 * (i + 1) / tot;
            }
            Array.Sort(sortArray, new sortObjectComparer()); //图片排序调用
            progress = 950;

            //直接在原来pictureBox上加载图片
            picturePanel picPanel;

            for (int i = 0; i < tot; i++)
            {
                picPanel     = (picturePanel)result_show.GetControlFromPosition(i % 5, i / 5);
                path_name[i] = sortArray[i].path;
                name[i]      = sortArray[i].name;
                picPanel.init(picInfo[path_name[i]].image, name[i]);
                selected[i]        = false;
                picPanel.BackColor = unselected_color;
                progress           = 950 + 50 * (i + 1) / tot;
            }
            progress = 1000;
            SortingResult sr = new SortingResult();

            sr.Show();
        }
Esempio n. 2
0
        //图片全参考排序
        private void imageSort_full_Click(object sender, EventArgs e)
        {
            resetSortPanel();
            this.Refresh();
            int    cnt   = 0;
            string _path = null;

            for (int i = 0; i < tot; i++)
            {
                if (selected[i])
                {
                    cnt++;
                    _path = path_name[i];
                }
            }
            if (cnt == 0)
            {
                MessageBox.Show("请选一张图片作为参考图像");
                return;
            }
            else if (cnt > 1)
            {
                MessageBox.Show("只能选一张图片作为参考图像");
                return;
            }

            progress = 0;
            Thread progressThread = new Thread(progress_thread);

            progressThread.IsBackground = true;
            progressThread.Start();
            sortObject[] sortArray = new sortObject[tot];
            for (int i = 0; i < tot; i++)
            {
                name_copy[i]      = name[i];
                path_name_copy[i] = path_name[i];
                if (!picInfo[path_name[i]].state_full || last_pic != _path)
                {
                    picInfo[path_name[i]].grade_full = picInfo[path_name[i]].psnr(picInfo[_path], picInfo[path_name[i]].height, picInfo[path_name[i]].width);
                    picInfo[path_name[i]].state_full = true;
                }
                sortArray[i] = new sortObject(picInfo[path_name[i]].grade_full, path_name[i], name[i]);
                progress     = 950 * (i + 1) / tot;
            }
            last_pic = _path;
            Array.Sort(sortArray, new sortObjectComparer()); //图片排序调用
            progress = 950;

            //直接在原来pictureBox上加载图片
            picturePanel picPanel;

            for (int i = 0; i < tot; i++)
            {
                picPanel     = (picturePanel)result_show.GetControlFromPosition(i % 5, i / 5);
                path_name[i] = sortArray[i].path;
                name[i]      = sortArray[i].name;
                picPanel.init(picInfo[path_name[i]].image, name[i]);
                selected[i]        = false;
                picPanel.BackColor = unselected_color;
                progress           = 950 + 50 * (i + 1) / tot;
            }
            progress = 1000;
            SortingResult sr = new SortingResult(_path);

            sr.Show();
        }