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(); }
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(); }
// get the uniformity by 5 zones. public double getuniformity(double[, ,] XYZ) { zoneresult zr = new zoneresult(); double[, ,] XYZ1, XYZ2, XYZ3, XYZ4, XYZ5; double lv1, lv2, lv3, lv4, lv5; XYZ1 = zr.XYZlocalzone(1, 10, XYZ); lv1 = getlv(XYZ1); XYZ2 = zr.XYZlocalzone(2, 10, XYZ); lv2 = getlv(XYZ2); XYZ3 = zr.XYZlocalzone(3, 10, XYZ); lv3 = getlv(XYZ3); XYZ4 = zr.XYZlocalzone(4, 10, XYZ); lv4 = getlv(XYZ4); XYZ5 = zr.XYZlocalzone(5, 10, XYZ); lv5 = getlv(XYZ5); double lvmin = new double[] { lv1, lv2, lv3, lv4, lv5 }.Min(); double lvmax = new double[] { lv1, lv2, lv3, lv4, lv5 }.Max(); double unif = lvmin / lvmax; return(unif); }