Ejemplo n.º 1
0
        private void CompareForm_Load(object sender, EventArgs e)
        {
            this.WindowState        = FormWindowState.Maximized;
            this.FormBorderStyle    = FormBorderStyle.FixedSingle;
            compare_image1.Width    = compare_image1.Height = (int)(this.Width * image_size_rate);
            compare_image2.Width    = compare_image2.Height = (int)(this.Width * image_size_rate);
            compare_image1.Location = new Point((int)(this.Width * 0.015), (int)(this.Height * 0.02));
            compare_image2.Location = new Point((int)(this.Width * 0.515), (int)(this.Height * 0.02));
            confirm.Location        = new Point((int)(this.Width * 0.475), (int)(this.Height * 0.86));

            double result1 = NR_algorithm.NR_method(
                SettingInfo.imageCompare_NRmethod,
                MainInfo.picInfo[MainInfo.path_name[id1]].rgb,
                MainInfo.picInfo[MainInfo.path_name[id1]].height,
                MainInfo.picInfo[MainInfo.path_name[id1]].width);
            double result2 = NR_algorithm.NR_method(
                SettingInfo.imageCompare_NRmethod,
                MainInfo.picInfo[MainInfo.path_name[id2]].rgb,
                MainInfo.picInfo[MainInfo.path_name[id2]].height,
                MainInfo.picInfo[MainInfo.path_name[id2]].width);
            int          score1 = NR_algorithm.NR_grade(SettingInfo.imageCompare_NRmethod, result1);
            int          score2 = NR_algorithm.NR_grade(SettingInfo.imageCompare_NRmethod, result2);
            picturePanel p1     = new picturePanel();
            picturePanel p2     = new picturePanel();

            compare_image1.Controls.Add(p1);
            compare_image2.Controls.Add(p2);
            p1.init(MainInfo.picInfo[MainInfo.path_name[id1]].image, "得分:" +  score1.ToString());
            p2.init(MainInfo.picInfo[MainInfo.path_name[id2]].image, "得分:"   +  score2.ToString());

            p1.image_name.Height = 33;
            p2.image_name.Height = 33;
            p1.image_name.Font   = new Font("微软雅黑", 18);
            p2.image_name.Font   = new Font("微软雅黑", 18);
        }
Ejemplo n.º 2
0
        //双击文字
        private void label_double_click(object sender, EventArgs e)
        {
            picturePanel p         = (picturePanel)(((Label)sender).Parent);
            Form         imageshow = new ImageView(picList, p.id);

            imageshow.Size = new Size(1024, 800);//新窗口界面大小和原窗口同样大
            imageshow.Show();
        }
Ejemplo n.º 3
0
        //双击图片
        private void pictureBox_double_click(object sender, EventArgs e)
        {
            PictureBox   curPicture = (PictureBox)(sender);
            picturePanel p          = (picturePanel)(curPicture.Parent);
            Form         imageshow  = new ImageView(picList, p.id);

            imageshow.Size = new Size(1024, 800);//新窗口界面大小和原窗口同样大
            imageshow.Show();
        }
Ejemplo n.º 4
0
        //双击单元格
        private void sorted_item_double_click(object sender, EventArgs e)
        {
            picturePanel p         = (picturePanel)sender;
            int          position  = p.id;
            Form         imageshow = new ImageView(sortedPicList, position);

            imageshow.Size = new Size(1024, 800);//新窗口界面大小和原窗口同样大
            imageshow.Show();
        }
Ejemplo n.º 5
0
        private void ImageDeleteComfirmForm_Load(object sender, EventArgs e)
        {
            this.WindowState     = FormWindowState.Maximized;
            this.FormBorderStyle = FormBorderStyle.FixedSingle;
            result.Width         = (int)(this.Width * 0.9);
            result.Height        = (int)(result.Width * 0.25);
            result.Location      = new Point((int)(this.Width * 0.04), (int)(this.Height * 0.25));
            hint.Location        = new Point((int)(result.Location.X + (result.Width - hint.Width) / 2), (int)(this.Height * 0.15));
            confirm.Location     = new Point((int)(this.Width * 0.37), (int)(this.Height * 0.82));
            cancel.Location      = new Point((int)(this.Width * 0.57), (int)(this.Height * 0.82));


            int n   = sortedArray.Length;
            int i   = n - (int)((double)n * delete_rate / 100);
            int tot = 0;

            picList = new string[n - i];
            for (; i < n; i++)
            {
                picturePanel p = new picturePanel(MainInfo.tot);
                if (tot % 4 == 0 && tot != 0)
                {
                    result.RowStyles.Insert(result.RowCount++, new RowStyle());
                }
                result.Controls.Add(p, tot % 4, tot / 4);
                p.init(MainInfo.picInfo[sortedArray[i].path].image, "质量分数:" + sortedArray[i].grade.ToString("f2"));
                p.image_name.Height = 28;
                p.image_name.Font   = new Font("微软雅黑", 16);
                p.DoubleClick      += e1;
                p.id = tot;
                ((PictureBox)(p.Controls[0])).DoubleClick += e2;
                ((Label)(p.Controls[1])).DoubleClick      += e3;
                picList[tot++] = sortedArray[i].path;
            }
            TableLayoutRowStyleCollection rowstyles;

            rowstyles = result.RowStyles;
            foreach (RowStyle style in rowstyles)
            {
                style.SizeType = SizeType.Absolute;
                style.Height   = result.Height - 4;
            }
            result.Width = result.Height * 4 + MainInfo.tot / 4 * 15;
            if (result.Width + result.Location.X + 20 > this.Width)
            {
                result.Width = this.Width - result.Location.X - 20;
            }
        }
Ejemplo n.º 6
0
        //添加图片到左边工作区
        bool add_image(string path, string _name)
        {
            if (MainInfo.picInfo.ContainsKey(path))
            {
                return(false); //图片已经存在,添加失败
            }
            Pic pic = new Pic(path, _name);

            MainInfo.picInfo.Add(path, pic);
            if (MainInfo.tot == 0)
            {
                resultPanel.ColumnCount = 5;
            }
            //添加新的图片单元格
            if (MainInfo.tot % 5 == 0)
            {
                resultPanel.RowStyles.Insert(resultPanel.RowCount++, new RowStyle());
                TableLayoutRowStyleCollection rowstyles;
                rowstyles = resultPanel.RowStyles;
                foreach (RowStyle style in rowstyles)
                {
                    style.SizeType = SizeType.Absolute;
                    style.Height   = resultPanel.Width / 5;
                }
            }
            MainInfo.name[MainInfo.tot] = _name;

            picturePanel p = new picturePanel();

            p.Name                 = MainInfo.tot.ToString();
            p.BackColor            = unselected_color;
            p.image_name.Height    = 25;
            p.image_name.Font      = new Font("微软雅黑", 12);
            p.image_name.ForeColor = Color.Black;
            p.image.Name           = MainInfo.tot.ToString();
            resultPanel.Controls.Add(p, MainInfo.tot % 5, MainInfo.tot / 5);
            p.init(MainInfo.picInfo[path].image, _name);
            MainInfo.path_name[MainInfo.tot] = path;
            resultPanel.Refresh();
            MainInfo.tot++;
            return(true); //成功添加图片
        }
Ejemplo n.º 7
0
        private void radioButton1_Click(object sender, EventArgs e)
        {
            radioButton1.Checked = true;
            radioButton2.Checked = false;
            temp_image           = new Bitmap(MainInfo.picInfo[_path].compress(100 - (Int64)rate_bar1.Value, imageformat[format_selection.Text]));
            ((picturePanel)(compressed_image.Controls[0])).init(temp_image, "预览".ToString());
            picturePanel tempP = (picturePanel)(compressed_image.Controls[0]);

            tempP.image_name.Font     = new Font("微软雅黑", 17);
            tempP.image_name.Height   = 32;
            tempP.image_name.Dock     = DockStyle.None;
            tempP.image_name.Location = new Point((tempP.image.Location.X), tempP.image.Location.Y + tempP.image.Height + 20);

            Pic    pic    = new Pic(temp_image);
            double result = FR_algorithm.FR_method(SettingInfo.imageCompress_FRmethod, MainInfo.picInfo[_path].rgb, pic.rgb, pic.height, pic.width);
            int    grade  = FR_algorithm.FR_grade(SettingInfo.imageCompress_FRmethod, result);

            rate_bar2.Value      = grade;
            rate2.Text           = rate_bar2.Value.ToString();
            algorithm_value.Text = "(" + SettingInfo.imageCompress_FRmethod + "值:" + result.ToString("f4") + ")";
        }
Ejemplo n.º 8
0
        private void rate_bar2_Scroll(object sender, EventArgs e)
        {
            rate2.Text = rate_bar2.Value.ToString();
            double result = 0;
            int    grade  = 0;

            if (radioButton2.Checked)
            {
                int l = 0, r = 100, mid;
                while (l != r)
                {
                    mid        = (l + r) >> 1;
                    temp_image = new Bitmap(MainInfo.picInfo[_path].compress((Int64)(mid + 1), imageformat[format_selection.Text]));
                    Pic pic = new Pic(temp_image);
                    result = FR_algorithm.FR_method(SettingInfo.imageCompress_FRmethod, MainInfo.picInfo[_path].rgb, pic.rgb, pic.height, pic.width);
                    grade  = FR_algorithm.FR_grade(SettingInfo.imageCompress_FRmethod, result);
                    if (grade > rate_bar2.Value)
                    {
                        r = mid;
                    }
                    else
                    {
                        l = mid + 1;
                    }
                }
                ((picturePanel)(compressed_image.Controls[0])).init(temp_image, "预览".ToString());
                picturePanel tempP = (picturePanel)(compressed_image.Controls[0]);
                tempP.image_name.Font     = new Font("微软雅黑", 17);
                tempP.image_name.Height   = 32;
                tempP.image_name.Dock     = DockStyle.None;
                tempP.image_name.Location = new Point((tempP.image.Location.X), tempP.image.Location.Y + tempP.image.Height + 20);

                rate_bar1.Value      = 100 - l;
                rate1.Text           = rate_bar1.Value.ToString();
                algorithm_value.Text = "(" + SettingInfo.imageCompress_FRmethod + "值:" + result.ToString("f4") + ")";
            }
        }
Ejemplo n.º 9
0
        private void compressForm_none_Load(object sender, EventArgs e)
        {
            this.WindowState               = FormWindowState.Maximized;
            this.FormBorderStyle           = FormBorderStyle.FixedSingle;
            format_selection.DropDownStyle = ComboBoxStyle.DropDownList;
            uncompressed_image.Width       = uncompressed_image.Height = compressed_image.Width = compressed_image.Height = (int)(this.Height * 0.65);
            uncompressed_image.Location    = new Point((int)(this.Width * 0.1), (int)(this.Height * 0.02));
            compressed_image.Location      = new Point((int)(this.Width * 0.55), (int)(this.Height * 0.02));
            image_format.Location          = new Point((int)(this.Width * 0.352), (int)(this.Height * 0.7));
            format_selection.Location      = new Point((int)(this.Width * 0.46), (int)(this.Height * 0.7));
            hint1.Location           = new Point((int)(image_format.Location.X + image_format.Width - hint1.Width), (int)(this.Height * 0.76));
            hint2.Location           = new Point((int)(image_format.Location.X + image_format.Width - hint2.Width), (int)(this.Height * 0.82));
            rate_bar1.Location       = new Point((int)(format_selection.Location.X + (format_selection.Width - rate_bar1.Width) / 2), (int)(this.Height * 0.76));
            rate_bar2.Location       = new Point((int)(format_selection.Location.X + (format_selection.Width - rate_bar2.Width) / 2), (int)(this.Height * 0.82));
            rate1.Location           = new Point((int)(this.Width * 0.59), (int)(this.Height * 0.76));
            rate2.Location           = new Point((int)(this.Width * 0.59), (int)(this.Height * 0.82));
            algorithm_value.Location = new Point((int)(this.Width * 0.65), (int)(this.Height * 0.82));
            radioButton1.Location    = new Point((int)(this.Width * 0.625), (int)(this.Height * 0.769));
            radioButton2.Location    = new Point((int)(this.Width * 0.625), (int)(this.Height * 0.829));
            save.Location            = new Point((int)(this.Width * 0.42), (int)(this.Height * 0.89));
            cancel.Location          = new Point((int)(this.Width * 0.55), (int)(this.Height * 0.89));

            if (SettingInfo.save_path == "default")
            {
                save_path = "default" + "\\" + _name + "(compressed)." + format_selection.Text;
                if (Directory.Exists("default") == false)
                {
                    Directory.CreateDirectory("default");
                }
            }
            else
            {
                save_path = SettingInfo.save_path + "\\" + _name + "(compressed)." + format_selection.Text;
            }

            p1 = new picturePanel();
            uncompressed_image.Controls.Add(p1);
            p1.init(MainInfo.picInfo[_path].image, "原图".ToString());
            p1.image_name.Font     = new Font("微软雅黑", 17);
            p1.image_name.Height   = 32;
            p1.image_name.Location = new Point((p1.image.Location.X), (p1.image.Location.Y + 20 + p1.image.Height));
            p1.image_name.Dock     = DockStyle.None;

            p2 = new picturePanel();
            compressed_image.Controls.Add(p2);
            p2.image_name.Font     = new Font("微软雅黑", 17);
            p2.image_name.Height   = 32;
            p2.image_name.Location = new Point((p2.image.Location.X), (p2.image.Location.Y + 20 + p2.image.Height));
            p2.image_name.Dock     = DockStyle.None;
            temp_image             = new Bitmap(MainInfo.picInfo[_path].compress(50, imageformat[format_selection.Text]));
            ((picturePanel)(compressed_image.Controls[0])).init(temp_image, "预览".ToString());
            picturePanel tempP = (picturePanel)(compressed_image.Controls[0]);

            tempP.image_name.Font     = new Font("微软雅黑", 17);
            tempP.image_name.Height   = 32;
            tempP.image_name.Dock     = DockStyle.None;
            tempP.image_name.Location = new Point((tempP.image.Location.X), tempP.image.Location.Y + tempP.image.Height + 20);

            temp_image = new Bitmap(MainInfo.picInfo[_path].compress(100 - (Int64)rate_bar1.Value, imageformat[format_selection.Text]));
            ((picturePanel)(compressed_image.Controls[0])).init(temp_image, "预览".ToString());
            tempP = (picturePanel)(compressed_image.Controls[0]);
            tempP.image_name.Font     = new Font("微软雅黑", 17);
            tempP.image_name.Height   = 32;
            tempP.image_name.Dock     = DockStyle.None;
            tempP.image_name.Location = new Point((tempP.image.Location.X), tempP.image.Location.Y + tempP.image.Height + 20);
            Pic    pic    = new Pic(temp_image);
            double result = FR_algorithm.FR_method(SettingInfo.imageCompress_FRmethod, MainInfo.picInfo[_path].rgb, pic.rgb, pic.height, pic.width);
            int    grade  = FR_algorithm.FR_grade(SettingInfo.imageCompress_FRmethod, result);

            rate_bar2.Value      = grade;
            rate2.Text           = rate_bar2.Value.ToString();
            algorithm_value.Text = "(" + SettingInfo.imageCompress_FRmethod + "值:" + result.ToString("f4") + ")";
        }
Ejemplo n.º 10
0
        private void SortingResult_Load(object sender, EventArgs e)
        {
            this.WindowState            = FormWindowState.Maximized;
            this.FormBorderStyle        = FormBorderStyle.FixedSingle;
            beforeSortingPanel.Height   = afterSortingPanel.Height = (int)(this.Height * 0.34);
            beforeSortingPanel.Width    = afterSortingPanel.Width = beforeSortingPanel.Height * 5;
            beforeSortingPanel.Location = new Point((int)(this.Width * 0.01), (int)(this.Height * 0.1));
            afterSortingPanel.Location  = new Point((int)(this.Width * 0.01), (int)(this.Height * 0.57));
            beforeSortingHint.Location  = new Point((int)((beforeSortingPanel.Width - beforeSortingHint.Width) / 2 + beforeSortingPanel.Location.X), (int)(this.Height * 0.05));
            afterSortingHint.Location   = new Point((int)((beforeSortingPanel.Width - beforeSortingHint.Width) / 2 + beforeSortingPanel.Location.X), (int)(this.Height * 0.52));
            TableLayoutColumnStyleCollection columnstyles = beforeSortingPanel.ColumnStyles;

            foreach (ColumnStyle style in columnstyles)
            {
                style.SizeType = SizeType.Absolute;
                style.Width    = beforeSortingPanel.Height;
            }
            columnstyles = afterSortingPanel.ColumnStyles;
            foreach (ColumnStyle style in columnstyles)
            {
                style.SizeType = SizeType.Absolute;
                style.Width    = afterSortingPanel.Height;
            }

            if (_path != null)
            {
                picturePanel p = new picturePanel();
                p.init(MainInfo.picInfo[_path].image, MainInfo.picInfo[_path].name);
                p.image_name.Font   = new Font("微软雅黑", 17);
                p.image_name.Height = 32;
            }
            if (_path == null)
            {
                originPicList = new string[picNum];
                for (int i = 0; i < picNum; i++)
                {
                    picturePanel p = new picturePanel(i);
                    beforeSortingPanel.ColumnStyles.Insert(beforeSortingPanel.ColumnCount++, new ColumnStyle(SizeType.Absolute, beforeSortingPanel.Height));
                    beforeSortingPanel.Controls.Add(p, i, 0);
                    p.init(MainInfo.picInfo[originArray[i].path].image, originArray[i].name);
                    p.image_name.Height = 25;
                    p.image_name.Font   = new Font("微软雅黑", 13);
                    p.DoubleClick      += origin_e1;
                    ((PictureBox)(p.Controls[0])).DoubleClick += origin_e2;
                    ((Label)(p.Controls[1])).DoubleClick      += origin_e3;
                    originPicList[i] = originArray[i].path;
                }

                sortedPicList = new string[picNum];
                for (int i = 0; i < picNum; i++)
                {
                    picturePanel p = new picturePanel(i);
                    afterSortingPanel.ColumnStyles.Insert(afterSortingPanel.ColumnCount++, new ColumnStyle(SizeType.Absolute, afterSortingPanel.Height));
                    afterSortingPanel.Controls.Add(p, i, 0);
                    p.init(MainInfo.picInfo[sortedArray[i].path].image, sortedArray[i].name);
                    p.image_name.Height = 25;
                    p.image_name.Font   = new Font("微软雅黑", 13);
                    p.DoubleClick      += sorted_e1;
                    ((PictureBox)(p.Controls[0])).DoubleClick += sorted_e2;
                    ((Label)(p.Controls[1])).DoubleClick      += sorted_e3;
                    sortedPicList[i] = sortedArray[i].path;
                }
            }
            else
            {
                originPicList = new string[picNum + 1];
                picturePanel pp = new picturePanel(0);
                beforeSortingPanel.ColumnStyles.Insert(beforeSortingPanel.ColumnCount++, new ColumnStyle(SizeType.Absolute, beforeSortingPanel.Height));
                beforeSortingPanel.Controls.Add(pp, 0, 0);
                pp.init(MainInfo.picInfo[_path].image, "参考图像");
                pp.image_name.Height = 25;
                pp.image_name.Font   = new Font("微软雅黑", 13);
                pp.DoubleClick      += origin_e1;
                pp.BackColor         = Color.Gray;
                ((PictureBox)(pp.Controls[0])).DoubleClick += origin_e2;
                ((Label)(pp.Controls[1])).DoubleClick      += origin_e3;
                originPicList[0] = _path;
                for (int i = 0; i < picNum; i++)
                {
                    picturePanel p = new picturePanel(i + 1);
                    beforeSortingPanel.ColumnStyles.Insert(beforeSortingPanel.ColumnCount++, new ColumnStyle(SizeType.Absolute, beforeSortingPanel.Height));
                    beforeSortingPanel.Controls.Add(p, i + 1, 0);
                    p.init(MainInfo.picInfo[originArray[i].path].image, originArray[i].name);
                    p.image_name.Height = 25;
                    p.image_name.Font   = new Font("微软雅黑", 13);
                    p.DoubleClick      += origin_e1;
                    ((PictureBox)(p.Controls[0])).DoubleClick += origin_e2;
                    ((Label)(p.Controls[1])).DoubleClick      += origin_e3;
                    originPicList[i + 1] = originArray[i].path;
                }

                sortedPicList = new string[picNum + 1];
                picturePanel ppp = new picturePanel(0);
                afterSortingPanel.ColumnStyles.Insert(afterSortingPanel.ColumnCount++, new ColumnStyle(SizeType.Absolute, afterSortingPanel.Height));
                afterSortingPanel.Controls.Add(ppp, 0, 0);
                ppp.init(MainInfo.picInfo[_path].image, "参考图像");
                ppp.image_name.Height = 25;
                ppp.image_name.Font   = new Font("微软雅黑", 13);
                ppp.DoubleClick      += sorted_e1;
                ppp.BackColor         = Color.Gray;
                ((PictureBox)(ppp.Controls[0])).DoubleClick += sorted_e2;
                ((Label)(ppp.Controls[1])).DoubleClick      += sorted_e3;
                sortedPicList[0] = _path;
                for (int i = 0; i < picNum; i++)
                {
                    picturePanel p = new picturePanel(i + 1);
                    afterSortingPanel.ColumnStyles.Insert(afterSortingPanel.ColumnCount++, new ColumnStyle(SizeType.Absolute, afterSortingPanel.Height));
                    afterSortingPanel.Controls.Add(p, i + 1, 0);
                    p.init(MainInfo.picInfo[sortedArray[i].path].image, sortedArray[i].name);
                    p.image_name.Height = 25;
                    p.image_name.Font   = new Font("微软雅黑", 13);
                    p.DoubleClick      += sorted_e1;
                    ((PictureBox)(p.Controls[0])).DoubleClick += sorted_e2;
                    ((Label)(p.Controls[1])).DoubleClick      += sorted_e3;
                    sortedPicList[i + 1] = sortedArray[i].path;
                }
            }
        }