示例#1
0
        private void DrawZone(Bitmap binImage, ColorPanel panel)
        {
            zoneresult zr = new zoneresult();
            Graphics   g  = Graphics.FromImage(binImage);

            for (int i = 1; i < 6; i++)
            {
                // get corner coordinates
                flagPoints = zr.zonecorners(i, zonesize, XYZ);
                // zone image
                g = zoneingimage(g, flagPoints);
                binImage.Save(tempdirectory + i.ToString() + "_" + panel.ToString() + "_bin_zone.bmp");
                flagPoints.Clear();
            }

            binImage.Save(tempdirectory + tbox_sn.Text + str_DateTime + "_" + panel.ToString() + "_bin_zone1-5.bmp");
            refreshtestimage(binImage, picturebox_test);
            g.Dispose();
        }
示例#2
0
        private void DrawZone(Bitmap binImage, ColorPanel panel)
        {
            string     imageName = string.Format("{0}{1}{2:yyyyMMddHHmmss}_{3}", IMAGE_SAVE_PATH, SerialNumber, DateTime.Now, panel.ToString());
            zoneresult zr        = new zoneresult();
            Graphics   g         = Graphics.FromImage(binImage);

            for (int i = 1; i < 6; i++)
            {
                // get corner coordinates
                List <IntPoint> flagPoints = zr.zonecorners(i, 10, ip.bmp2rgb(binImage));
                // zone image
                g = ZoneImage(g, flagPoints);
                binImage.Save(IMAGE_SAVE_PATH + i.ToString() + "_" + panel.ToString() + "_bin_zone.bmp");
                flagPoints.Clear();
            }

            binImage.Save(imageName + "_bin_zone1-5.bmp");
            //refreshtestimage(binImage, picturebox_test);
            args.Image = binImage;
            dataChange.Invoke(this, args);
            g.Dispose();
        }
示例#3
0
        private bool DisplayTest(List <IntPoint> displaycornerPoints, Bitmap bitmap, ColorPanel panelType)
        {
            // show cropping image
            this.refreshtestimage(bitmap, picturebox_test);

            if (panelType == ColorPanel.White)
            {
                ip.GetDisplayCornerfrombmp(bitmap, out displaycornerPoints);
            }

            // ԭʼͼÏñ
            string imageName = tempdirectory + tbox_sn.Text + str_DateTime + "_" + panelType.ToString() + ".bmp";

            bitmap.Save(imageName);
            //need save bmp outside as file format and reload so that
            Bitmap srcimg = new Bitmap(System.Drawing.Image.FromFile(imageName, true));
            // ÕÒ³öÆÁÄ»ÇøÓòµÄͼÏñ
            Bitmap updateimg = croppingimage(srcimg, displaycornerPoints);

            this.refreshtestimage(updateimg, picturebox_test);

            // ½ØÈ¡ÇøÓòͼÏñ
            Bitmap cropimg = ip.croppedimage(srcimg, displaycornerPoints, dut.ui_width, dut.ui_height);

            cropimg.Save(tempdirectory + tbox_sn.Text + str_DateTime + "_cropped.bmp");
            picturebox_test.Width  = cropimg.Width;
            picturebox_test.Height = cropimg.Height;
            this.refreshtestimage(cropimg, picturebox_test);

            // binary ͼÏñ
            Bitmap binimg = new Bitmap(cropimg, new Size(dut.bin_width, dut.bin_height));

            binimg.Save(tempdirectory + tbox_sn.Text + str_DateTime + "_" + panelType.ToString() + "_bin.bmp");

            ColorimeterResult colorimeterRst = new ColorimeterResult(bitmap, panelType);

            colorimeterRst.Analysis();

            switch (panelType)
            {
            case ColorPanel.White:
                this.DrawZone(binimg, panelType);
                cbox_white_lv.Checked = cbox_white_uniformity.Checked = cbox_white_mura.Checked = true;
                tbox_whitelv.Text     = colorimeterRst.Luminance.ToString();
                tbox_whiteunif.Text   = (colorimeterRst.Uniformity5 * 100).ToString();
                tbox_whitemura.Text   = colorimeterRst.Mura.ToString();
                log.WriteUartLog(string.Format("luminance: {0}, uniformity5: {1}, mura: {2}",
                                               colorimeterRst.Luminance, colorimeterRst.Uniformity5, colorimeterRst.Mura));
                break;

            case ColorPanel.Black:
                this.DrawZone(binimg, panelType);
                cbox_black_lv.Checked = cbox_black_uniformity.Checked = cbox_black_mura.Checked = true;
                tbox_blacklv.Text     = colorimeterRst.Luminance.ToString();
                tbox_blackunif.Text   = (colorimeterRst.Uniformity5 * 100).ToString();
                tbox_blackmura.Text   = colorimeterRst.Mura.ToString();
                log.WriteUartLog(string.Format("luminance: {0}, uniformity5: {1}, mura: {2}",
                                               colorimeterRst.Luminance, colorimeterRst.Uniformity5, colorimeterRst.Mura));
                break;

            case ColorPanel.Red:
                cbox_red.Checked = true;
                tbox_red.Text    = colorimeterRst.CIE1931xyY.ToString();
                log.WriteUartLog(colorimeterRst.CIE1931xyY.ToString());
                break;

            case ColorPanel.Green:
                cbox_green.Checked = true;
                tbox_green.Text    = colorimeterRst.CIE1931xyY.ToString();
                log.WriteUartLog(colorimeterRst.CIE1931xyY.ToString());
                break;

            case ColorPanel.Blue:
                cbox_blue.Checked = true;
                tbox_blue.Text    = colorimeterRst.CIE1931xyY.ToString();
                log.WriteUartLog(colorimeterRst.CIE1931xyY.ToString());
                break;
            }
            log.WriteUartLog("\r\n");

            return(this.AnaylseResult(colorimeterRst, panelType));
        }
示例#4
0
        private bool DisplayTest(List <IntPoint> displaycornerPoints, Bitmap bitmap, ColorPanel panelType)
        {
            if (panelType == ColorPanel.White)
            {
                ip.GetDisplayCornerfrombmp(bitmap, out displaycornerPoints);
            }

            // 原始图像
            string imageName = string.Format("{0}{1}{2:yyyyMMddHHmmss}_{3}", IMAGE_SAVE_PATH, SerialNumber, DateTime.Now, panelType.ToString());

            bitmap.Save(imageName + ".bmp");

            //need save bmp outside as file format and reload so that
            Bitmap srcimg = new Bitmap(System.Drawing.Image.FromFile(imageName, true));

            // 找出屏幕区域的图像
            Bitmap updateimg = CroppingImage(srcimg, displaycornerPoints);

            args.Image = updateimg;
            dataChange.Invoke(this, args);
            // this.refreshtestimage(updateimg, picturebox_test);

            // 截取区域图像
            Bitmap cropimg = ip.croppedimage(srcimg, displaycornerPoints, dut.ui_width, dut.ui_height);

            cropimg.Save(imageName + "_cropped.bmp");
            args.Image = cropimg;
            dataChange.Invoke(this, args);
            //picturebox_test.Width = cropimg.Width;
            //picturebox_test.Height = cropimg.Height;
            //this.refreshtestimage(cropimg, picturebox_test);

            // binary 图像
            Bitmap binimg = new Bitmap(cropimg, new Size(dut.bin_width, dut.bin_height));

            binimg.Save(imageName + "_bin.bmp");

            ColorimeterResult colorimeterRst = new ColorimeterResult(bitmap, panelType);

            colorimeterRst.Analysis();

            switch (panelType)
            {
            case ColorPanel.White:
                //this.DrawZone(binimg, panelType);
                //cbox_white_lv.Checked = cbox_white_uniformity.Checked = cbox_white_mura.Checked = true;
                //tbox_whitelv.Text = colorimeterRst.Luminance.ToString();
                //tbox_whiteunif.Text = (colorimeterRst.Uniformity5 * 100).ToString();
                //tbox_whitemura.Text = colorimeterRst.Mura.ToString();
                log.WriteUartLog(string.Format("luminance: {0}, uniformity5: {1}, mura: {2}",
                                               colorimeterRst.Luminance, colorimeterRst.Uniformity5, colorimeterRst.Mura));
                break;

            case ColorPanel.Black:
                //this.DrawZone(binimg, panelType);
                //cbox_black_lv.Checked = cbox_black_uniformity.Checked = cbox_black_mura.Checked = true;
                //tbox_blacklv.Text = colorimeterRst.Luminance.ToString();
                //tbox_blackunif.Text = (colorimeterRst.Uniformity5 * 100).ToString();
                //tbox_blackmura.Text = colorimeterRst.Mura.ToString();
                log.WriteUartLog(string.Format("luminance: {0}, uniformity5: {1}, mura: {2}",
                                               colorimeterRst.Luminance, colorimeterRst.Uniformity5, colorimeterRst.Mura));
                break;

            case ColorPanel.Red:
                //cbox_red.Checked = true;
                //tbox_red.Text = colorimeterRst.CIE1931xyY.ToString();
                log.WriteUartLog(colorimeterRst.CIE1931xyY.ToString());
                break;

            case ColorPanel.Green:
                //cbox_green.Checked = true;
                //tbox_green.Text = colorimeterRst.CIE1931xyY.ToString();
                log.WriteUartLog(colorimeterRst.CIE1931xyY.ToString());
                break;

            case ColorPanel.Blue:
                //cbox_blue.Checked = true;
                //tbox_blue.Text = colorimeterRst.CIE1931xyY.ToString();
                log.WriteUartLog(colorimeterRst.CIE1931xyY.ToString());
                break;
            }
            log.WriteUartLog("\r\n");

            return(true);//this.AnaylseResult(colorimeterRst, panelType);
        }
示例#5
0
        private bool RunDisplayTest(TestItem testItem, Bitmap bitmap, List <IntPoint> ptCorners)
        {
            bool       flag      = true;
            ColorPanel panel     = (ColorPanel)Enum.Parse(typeof(ColorPanel), testItem.TestName);
            string     imageName = string.Format("{0}{1}{2:yyyyMMddHHmmss}_{3}", IMAGE_SAVE_PATH, SerialNumber, DateTime.Now, panel.ToString());

            if (panel == ColorPanel.White)
            {
                ip.GetDisplayCornerfrombmp(bitmap, out ptCorners);
            }

            // save original image
            bitmap.Save(imageName);

            // cropping screen image
            Bitmap srcimg    = new Bitmap(System.Drawing.Image.FromFile(imageName, true));
            Bitmap updateimg = CroppingImage(srcimg, ptCorners);

            args.Image = updateimg;
            dataChange.Invoke(this, args);

            // 截取区域图像
            Bitmap cropimg = ip.croppedimage(srcimg, ptCorners, dut.ui_width, dut.ui_height);

            cropimg.Save(imageName + "_cropped.bmp");
            args.Image = cropimg;
            dataChange.Invoke(this, args);

            // anaylse
            ColorimeterResult colorimeterRst = new ColorimeterResult(cropimg, panel);

            colorimeterRst.Analysis();
            this.DrawZone(cropimg, panel);

            switch (panel)
            {
            case ColorPanel.White:
            case ColorPanel.Black:
                testItem.SubNodes[0].Value = colorimeterRst.Luminance;
                testItem.SubNodes[1].Value = colorimeterRst.Uniformity5;
                testItem.SubNodes[2].Value = colorimeterRst.Mura;
                break;

            case ColorPanel.Red:
            case ColorPanel.Green:
            case ColorPanel.Blue:
                testItem.SubNodes[0].Value = colorimeterRst.CIE1931xyY.x;
                testItem.SubNodes[1].Value = colorimeterRst.CIE1931xyY.y;
                testItem.SubNodes[2].Value = colorimeterRst.CIE1931xyY.Y;
                break;
            }

            foreach (TestNode node in testItem.SubNodes)
            {
                flag &= node.Run();
            }
            dataChange.Invoke(this, args);

            return(flag);
        }