示例#1
0
        public WriteableBitmap getAreaLResove(WriteableBitmap b)
        {
            int LsratrX, LstartY, LW, LH;

            LsratrX = Convert.ToInt32(20.9 / 70.9 * (b.PixelHeight / 9 * 16));
            LsratrX = getCenterX(LsratrX, b.PixelWidth, b.PixelHeight);
            LstartY = Convert.ToInt32(18.8 / 39.9 * b.PixelHeight);
            LW      = Convert.ToInt32(12.7 / 70.9 * (b.PixelHeight / 9 * 16));
            LH      = Convert.ToInt32(2.2 / 39.9 * b.PixelHeight);

            if (IsAnalyse)
            {
                DrawSelectArea(LsratrX, LstartY, LW, LH);
            }

            WriteableBitmap lb = getImageArea(b, LsratrX, LstartY, LW, LH);

            if (mp.SelectedArea.ContainsKey("RayleiResolutionLArea"))
            {
                mp.SelectedArea["RayleiResolutionLArea"] = WriteableBitmapHelper.Clone(lb);
            }
            else
            {
                mp.SelectedArea.Add("RayleiResolutionLArea", WriteableBitmapHelper.Clone(lb));
            }
            return(lb);
        }
        public void ReadImageFromFile()//加载照片
        {
            var bl = SilverlightLFC.common.Environment.getEnvironment().OpenImage();

            if (bl == null || bl.Result == null || bl.Result.Count == 0)
            {
                return;
            }
            var v = bl.Result.FirstOrDefault();

            if (v == null)
            {
                return;
            }
            //PhotoLayers.Children.Clear();
            if (SelectLayer == null)
            {
                PhotoLayer pl = new PhotoLayer();
                PhotoLayers.Children.Add(pl);
                SelectLayer = pl;
                //return;
            }

            SelectLayer.setPhoto(WriteableBitmapHelper.Clone(v), ScalePercent);
            setClip();
            //SelectLayer.setScale(ScalePercent);
        }
示例#3
0
 public WriteableBitmap getClip()
 {
     if ((SelectedImage == null) || (SelectedImage.Source == null) || !(SelectedImage.Source is BitmapSource))
     {
         SilverlightLFC.common.Environment.ShowMessage("粘帖图片为空"); return(null);
     }
     return(WriteableBitmapHelper.Clone(SelectedImage.Source as WriteableBitmap));
 }
示例#4
0
 void ChartPhoto_PhotoChanged(WriteableBitmap current)
 {
     if (IsNeedSave)                                                     //自己处理的结果不需要保存
     {
         TempPhoto = WriteableBitmapHelper.Clone(ChartPhoto.getPhoto()); //备份原始图像
     }
     //throw new NotImplementedException();
     IsNeedSave = true;//默认都是要存的
 }
示例#5
0
        //LParameter getTestParameter()
        //{
        //    LParameter lp = new LParameter();
        //    lp.Name = "亮度一致性";
        //    lp.Memo = "通过拍摄均匀光照下的灰度卡测试成像的亮度一致性";
        //    lp.Dimension = "%";
        //    lp.TestWay = "中调灰卡";
        //    lp.TestTime = EndTime;
        //    lp.SpendTime = (EndTime - BeginTime).TotalMilliseconds;
        //    lp.Value = Convert.ToDouble(TextValue.Text);
        //    return lp;
        //}
        //public void WriteToHTML()
        //{
        //    LParameter lp = getTestParameter();

        //    string s = "";
        //    s = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN/\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\">";
        //    s = s + "<head><meta http-equiv=\"Content-Language\" content=\"zh-cn\" /><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />";
        //    s = s + "<title>shiyan</title><style type=\"text/css\">.style1 {text-align: left;}.style2 {margin-left: 40px;}.style3 {	text-decoration: underline;	margin-left: 40px;}</style></head>";
        //    s = s + "<body>";

        //    s = s + "<h2>测试结果信息:</h2>";
        //    //foreach (IParameter p in ResultList)
        //    //{
        //    s = s + "指标名称:" + lp.Name;
        //    s = s + "<p class=\"style2\">说明:" + lp.Memo + "</p>";
        //    s = s + "<p>测试时间:" + lp.TestTime.ToString() + "</p>";
        //    if (lp.Value != Double.NaN)
        //    {
        //        s = s + "<p>测试值:" + lp.Value.ToString() + lp.Dimension + "</p>";
        //    }
        //    //}


        //    s = s + "</body></html>";

        //    SilverlightLFC.common.Environment.getEnvironment().SaveFileString(s, "HTML文件|*.html");
        //    //SaveFileDialog of = new SaveFileDialog();
        //    //of.Filter = "HTML文件|*.html";
        //    //of.ShowDialog();
        //    //byte[] sb = System.Text.Encoding.Unicode.GetBytes(s);
        //    //Stream fs = of.OpenFile();
        //    //if (fs != null)
        //    //{
        //    //    fs.Write(sb, 0, sb.Length);
        //    //}
        //    //fs.Close();
        //}

        private void buttonResumePhoto_Click(object sender, RoutedEventArgs e)
        {
            if (TempPhoto != null)
            {
                ChartPhoto.setPhoto(WriteableBitmapHelper.Clone(TempPhoto));
                //testHelper.CurrentChart = new WriteableBitmap(TempPhoto);
                //TempPhoto = null;
            }
        }
示例#6
0
        public List <WriteableBitmap> getClipList()
        {
            List <WriteableBitmap> bl = new List <WriteableBitmap>();

            foreach (Image im in ClipList.Children)
            {
                bl.Add(WriteableBitmapHelper.Clone(im.Source as WriteableBitmap));
            }
            return(bl);
        }
示例#7
0
        //private void buttonTest_Click(object sender, RoutedEventArgs e)
        //{
        //    autoTest();
        //}

        private void buttonOpen_Click(object sender, RoutedEventArgs e)
        {
            var b = SilverlightLFC.common.Environment.getEnvironment().OpenImage();

            if (b == null || b.Result.Count == 0)
            {
                return;
            }
            ChartPhoto.setPhoto(WriteableBitmapHelper.Clone(b.Result.FirstOrDefault()));
        }
示例#8
0
        public WriteableBitmap CorrectXMark(WriteableBitmap b) //矫正,并且返回矫正以后的图像
        {                                                      //首先使用中心圆进行位置矫正
         //再检查上面的两个角圆的圆心,利用其来矫正角度
         //然后检查左右的对称性
         //然后利用中心园检查上下的对称
         //检查中心园的直径,建立像素和大小的关系

            Point CP = getCenterPoint(b, 100);//找到真正的图片中心点

            if (CP.X == Double.NaN || CP.Y == Double.NaN)
            {
                return(null);
            }
            if (CP.X == 0 && CP.Y == 0)
            {
                return(b);
            }
            int             dx = Convert.ToInt32(CP.X - b.PixelWidth / 2);
            int             dy = Convert.ToInt32(CP.Y - b.PixelHeight / 2);
            WriteableBitmap cb = MoveTrans(b, -dx, -dy);//对准操作

            mp.CorrectMovePhoto = WriteableBitmapHelper.Clone(cb);

            Point LTP, RTP, LBP;

            LTP = getLTPoint(cb);
            RTP = getRTPoint(cb);

            LTP = getTrueCircleCenter(cb, LTP);
            RTP = getTrueCircleCenter(cb, RTP);
            float arc = getArc(LTP, RTP);               //得到倾斜的角度

            WriteableBitmap rb = RotateTrans(cb, -arc); //矫正角度

            //cb.Dispose();
            CorrectPhoto          = SilverlightLFC.common.WriteableBitmapHelper.Clone(rb);//给出纠正角度的
            mp.CorrectRotatePhoto = SilverlightLFC.common.WriteableBitmapHelper.Clone(CorrectPhoto);
            //不进行缩放,而是矫正定位,让其他的方法定位的区域依据四角的标定点进行。
            //mp.CorrectScalePhoto = mp.CorrectRotatePhoto;

            LBP = getLBPoint(rb);
            LBP = getTrueCircleCenter(rb, LBP);

            int CropW = Convert.ToInt32(RTP.X - LTP.X);
            int CropH = Convert.ToInt32(LBP.Y - LTP.Y);

            WriteableBitmap CropB;

            CropB = getImageArea(rb, Convert.ToInt32(LTP.X), Convert.ToInt32(LTP.Y), CropW, CropH);
            //rb.Dispose();
            CropPhoto        = SilverlightLFC.common.WriteableBitmapHelper.Clone(CropB);//在本对象记录下裁剪过的图像
            mp.SelectedPhoto = SilverlightLFC.common.WriteableBitmapHelper.Clone(CropB);
            mp.CroppedPhoto  = WriteableBitmapHelper.Clone(CropB);
            return(CropB);
        }
示例#9
0
 public void setSelectArea(string key, WriteableBitmap b)//自动设置选区,并且改变不会影响原始信息
 {
     if (mp.SelectedArea.ContainsKey(key))
     {
         mp.SelectedArea[key] = WriteableBitmapHelper.Clone(b);
     }
     else
     {
         mp.SelectedArea.Add(key, WriteableBitmapHelper.Clone(b));
     }
 }
示例#10
0
 public void DrawSelectArea(int StartX, int StartY, int w, int h)//在分析照片上面绘制出选择的区域,便于调试
 {
     if (AnalysePhoto == null)
     {
         if (mp.SourcePhoto == null)
         {
             return;
         }
         mp.SelectedPhoto = WriteableBitmapHelper.Clone(mp.SourcePhoto);
     }
     DrawRecArea(AnalysePhoto, StartX, StartY, w, h, Colors.Red);
     //mp.SelectedPhoto = new WriteableBitmap(AnalysePhoto);
 }
示例#11
0
 public override void CorrectChart()//使用默认的内部来进行纠正
 {
     if (ChartPhoto == null)
     {
         ChartPhoto       = mp.SourcePhoto;
         mp.SelectedPhoto = CorrectISO12233Chart(ChartPhoto);
         CorrectPhoto     = WriteableBitmapHelper.Clone(AnalysePhoto);
     }
     else
     {
         mp.SelectedPhoto = CorrectISO12233Chart(ChartPhoto);
         CorrectPhoto     = WriteableBitmapHelper.Clone(AnalysePhoto);
     }
 }
示例#12
0
        public void Copy()//把图片复制到剪贴板
        {
            //CameraTestDesktop d = CameraTestDesktop.getDesktop();
            if (SelectLayer == null)
            {
                if (PhotoLayers.Children.Count == 0)
                {
                    return;
                }
                SelectLayer = PhotoLayers.Children[0] as PhotoLayer;
            }

            PhotoEditManager.Copy(WriteableBitmapHelper.Clone(SelectLayer.getPhoto()));
        }
示例#13
0
        private void buttonPaste_Click(object sender, RoutedEventArgs e)
        {
            ClearActiveAll();
            CameraTestDesktop d = CameraTestDesktop.getDesktop();

            if (d.getClip() == null)
            {
                return;
            }
            ProcessImageCanvas.setPhoto(WriteableBitmapHelper.Clone(d.getClip()));
            if (PhotoOperate != null)
            {
                PhotoOperate("Paste", ProcessImageCanvas.getPhoto());
            }
        }
示例#14
0
 public override void CorrectChart()//使用默认的内部来进行纠正
 {
     if (mp.SourcePhoto == null)
     {
         return;
         //ChartPhoto = mp.SourcePhoto;//直接使用记录的位图
         //mp.CorrectPhoto = CorrectISO12233Chart(SourcePhoto);
         //mp.SelectedPhoto = new WriteableBitmap(mp.CorrectPhoto);
     }
     else
     {
         mp.CorrectPhoto  = CorrectISO12233Chart(ChartPhoto);
         mp.SelectedPhoto = WriteableBitmapHelper.Clone(mp.CorrectPhoto);
     }
 }
示例#15
0
        public async void MergineSelect()//合并选择区编辑的结果,实际是sImg和底层的拼合
        {
            Layer.Children.Remove(canvasTempObject);

            //Layer.Children.Remove(Photo);

            WriteableBitmap mb = await WriteableBitmapHelper.Snapshot(Layer);

            //canvasSelect.Children.Clear();
            Photo.Source = mb;
            _Photo       = mb;
            sImg.Source  = null;
            Layer.Children.Remove(sImg);
            Layer.Children.Remove(canvasTempObject);
        }
示例#16
0
        public WriteableBitmap getBrightChangesImage(int n)//绘制亮度变化曲线,共n级
        {
            if (ChartPhoto == null)
            {
                throw new SilverlightLFC.common.LFCException("没有设置测试卡照片", null);
            }
            WriteableBitmap cb  = getImageArea(ChartPhoto, Convert.ToInt32(ChartPhoto.PixelWidth * 0.475), Convert.ToInt32(ChartPhoto.PixelHeight * 0.475), Convert.ToInt32(ChartPhoto.PixelWidth * 0.05), Convert.ToInt32(ChartPhoto.PixelHeight * 0.05));
            WriteableBitmap ltb = getImageArea(ChartPhoto, 0, 0, Convert.ToInt32(ChartPhoto.PixelWidth * 0.05), Convert.ToInt32(ChartPhoto.PixelHeight * 0.05));
            WriteableBitmap rtb = getImageArea(ChartPhoto, Convert.ToInt32(ChartPhoto.PixelWidth * 0.95), 0, Convert.ToInt32(ChartPhoto.PixelWidth * 0.05), Convert.ToInt32(ChartPhoto.PixelHeight * 0.05));
            WriteableBitmap lbb = getImageArea(ChartPhoto, 0, Convert.ToInt32(ChartPhoto.PixelHeight * 0.95), Convert.ToInt32(ChartPhoto.PixelWidth * 0.05), Convert.ToInt32(ChartPhoto.PixelHeight * 0.05));
            WriteableBitmap rbb = getImageArea(ChartPhoto, Convert.ToInt32(ChartPhoto.PixelWidth * 0.95), Convert.ToInt32(ChartPhoto.PixelHeight * 0.95), Convert.ToInt32(ChartPhoto.PixelWidth * 0.05), Convert.ToInt32(ChartPhoto.PixelHeight * 0.05));

            Color cc  = getAverageColor(cb);
            Color ltc = getAverageColor(ltb);
            Color rtc = getAverageColor(rtb);
            Color lbc = getAverageColor(lbb);
            Color rbc = getAverageColor(rbb);

            double bc  = .299 * cc.R + .587 * cc.G + .114 * cc.B;
            double blt = .299 * ltc.R + .587 * ltc.G + .114 * ltc.B;
            double brt = .299 * rtc.R + .587 * rtc.G + .114 * rtc.B;
            double blb = .299 * lbc.R + .587 * lbc.G + .114 * lbc.B;
            double brb = .299 * rbc.R + .587 * rbc.G + .114 * rbc.B;

            double bb = (blt + brt + blb + brb) / 4;                              //平均四角亮度
            double th = bc - bb;                                                  //亮度差
            double ph = th / n;                                                   //平均每级的亮度

            WriteableBitmap vb         = WriteableBitmapHelper.Clone(ChartPhoto); //复制一份
            var             components = vb.PixelBuffer.ToArray();

            for (int i = 0; i < components.Length; i += 4)
            {
                Color c = new Color();
                c.B = components[i];
                c.G = components[i + 1];
                c.R = components[i + 2];
                c.A = components[i + 3];
                double cbright = 0.299 * c.R + 0.587 * c.G + 0.114 * c.B;
                Byte   tbright = DrawPixToGradeBright(cbright, bc, ph, n);
                components[i]     = tbright;
                components[i + 1] = tbright;
                components[i + 2] = tbright;
                components[i + 3] = 255;
            }

            return(vb);
        }
示例#17
0
        public async Task <WriteableBitmap> getImage()//得到一个最终拼合图层的位图
        {
            ScaleTransform st = new ScaleTransform();

            st.ScaleX = 1 / ScalePercent;
            st.ScaleY = 1 / ScalePercent;
            DCTestLibrary.PhotoTest pt = new DCTestLibrary.PhotoTest();
            var tp = PhotoLayers.RenderTransform as TransformGroup;

            if (tp != null)
            {
                tp.Children.Add(st);
            }
            WriteableBitmap b = await WriteableBitmapHelper.Snapshot(PhotoLayers);

            //WriteableBitmap b = new WriteableBitmap(PhotoLayers, null);
            return(b);
        }
示例#18
0
        public void Test(List <WriteableBitmap> bList)
        {
            if (bList == null || bList.Count == 0)
            {
                return;
            }
            var b = bList.FirstOrDefault();

            sb = WriteableBitmapHelper.Clone(b);
            if (!IsLeft)
            {
                b = isoc.FlipYImage(b);
            }

            lChartPhoto1.Photo = (b);
            try
            {
                long l = isoc.getResoveLines(sb, 0.735f, IsLeft);
                if (IsLeft)
                {
                    textBlockIsLeft.Text = "左";
                }
                else
                {
                    textBlockIsLeft.Text = "右";
                }

                testResult.Text = l.ToString() + "LP";

                BorderLeft  = Convert.ToDouble(isoc.ptp.ProcessInfor["RayleiResolutionLeftBorder"]);
                BorderRight = Convert.ToDouble(isoc.ptp.ProcessInfor["RayleiResolutionRightBorder"]);
                double p = Convert.ToDouble(isoc.ptp.ProcessInfor["RayleiResolutionRightPosition"]);



                string st = isoc.ptp.ProcessInfor["ISOCardType"].ToString();
                if (st == "100-600")
                {
                    comboBox1.SelectedIndex = 2;
                }
                if (st == "500-2000")
                {
                    comboBox1.SelectedIndex = 0;
                }
                if (st == "1000-4000")
                {
                    comboBox1.SelectedIndex = 1;
                }

                leftBorder.Text  = BorderLeft.ToString();
                rightBorder.Text = BorderRight.ToString();
                RayleP.Text      = p.ToString();

                ll.Y1 = 0;
                ll.Y2 = lChartPhoto1.Height;
                ll.X1 = BorderLeft / b.PixelWidth * lChartPhoto1.Width;
                ll.X2 = ll.X1;
                if (!lChartPhoto1.getDrawObjectCanvas().Children.Contains(ll))
                {
                    lChartPhoto1.getDrawObjectCanvas().Children.Add(ll);
                }

                rl.Y1 = 0;
                rl.Y2 = lChartPhoto1.Height;
                rl.X1 = BorderRight / b.PixelWidth * lChartPhoto1.Width;
                rl.X2 = rl.X1;
                if (!lChartPhoto1.getDrawObjectCanvas().Children.Contains(rl))
                {
                    lChartPhoto1.getDrawObjectCanvas().Children.Add(rl);
                }

                pl.Y1 = 0;
                pl.Y2 = lChartPhoto1.Height;
                pl.X1 = p / b.PixelWidth * lChartPhoto1.Width;
                pl.X2 = pl.X1;
                if (!lChartPhoto1.getDrawObjectCanvas().Children.Contains(pl))
                {
                    lChartPhoto1.getDrawObjectCanvas().Children.Add(pl);
                }

                canvasBright.Children.Clear();
                DrawGraphic dg = new DrawGraphic(canvasBright);
                dg.DrawBrightLines(isoc.getImageGrayVLine(b, Convert.ToInt64(p)));
            }
            catch (Exception xe)        //未知的异常
            {
                if (xe is LFCException) //已经是系统约定的错误类型,直接往上抛
                {
                    SilverlightLFC.common.Environment.ShowMessage(xe.Message);
                }
                else
                {
                    SilverlightLFC.common.Environment.ShowMessage("测试错误,请检查照片");
                }
            }
        }
示例#19
0
        private int LatitudeBrightChange = 7;  //可以被识别出来的亮度等级的亮度差

        public override void BeginAnalyse()
        {
            IsAnalyse        = true;
            mp.SelectedPhoto = WriteableBitmapHelper.Clone(CropPhoto);
        }//开始调试状态,主要是保存选取区域
示例#20
0
        public WriteableBitmap CorrectISO12233Chart(WriteableBitmap b) //纠正ISO12233方位,包括位置和旋转以及大小比例
        {                                                              //算法是先得到包含中心方下侧边界的图像,测定图像中点的中心方下边界位置。同时得到距离中心线左右各1.5cm的垂线和黑方块的交点,轻易计算出倾角
            //对小图纠倾,然后上面1毫米处得出水平线。从中央,向两侧找到两边位置坐标,就可以知道水平偏离中心的情况
            //左侧边界向内一毫米位置,从原始图上面取列,可以得出上下的位置坐标,算出偏离垂直中心的情况
            //对原图,先纠正(角度),再纠偏(位置)
            //最后,依据中心方的大小,来矫正缩放的比例,其边长为高度的大约0.1(0.10020)
            WriteableBitmap r, parc, ppos;

            mp.SourcePhoto = WriteableBitmapHelper.Clone(b);
            var             tt = mp.SourcePhoto.PixelBuffer.ToArray();
            WriteableBitmap cb = CorrectArcRegion(b); //只切下面的1/4高度来检查倾斜性

            cb = AutoBright(cb);                      //给出自动白平衡
            mp.CorrectBrightPhoto = WriteableBitmapHelper.Clone(cb);
            float arc = 0;
            Point tcp = PhotoTest.NullPoint;
            Point tlp = PhotoTest.NullPoint;
            Point trp = PhotoTest.NullPoint;

            List <int> al = getImageGrayVLine(cb, cb.PixelWidth / 2); //中点的位置取垂直像素列
            int        cy = FindLastBlack(al, 100);                   //找到越变点位置,注意是从大向小找。

            if (cy != -1)
            {
                tcp = new Point(cb.PixelWidth / 2, cy);//这是中央相交点
            }
            double bs  = 1.5 / 39.9;
            int    bps = Convert.ToInt32(bs * b.PixelHeight);

            List <int> lal = getImageGrayVLine(cb, cb.PixelWidth / 2 - bps); //中点的左侧位置取垂直像素列
            int        ly  = FindLastBlack(lal, 100);                        //找到越变点位置,注意是从大向小找。

            if (ly != -1)
            {
                tlp = new Point(cb.PixelWidth / 2 - bps, ly);           //这是左侧相交点
                if (Math.Abs((tcp.Y - tlp.Y) / (tcp.X - tlp.X)) > 0.75) //检查,如果找到的倾斜角度超过37度,矫正失败
                {
                    tlp = new Point();
                }
            }

            List <int> ral = getImageGrayVLine(cb, cb.PixelWidth / 2 + bps); //中点的右侧位置取垂直像素列
            int        ry  = FindLastBlack(ral, 100);                        //找到越变点位置,注意是从大向小找。

            if (ry != -1)
            {
                trp = new Point(cb.PixelWidth / 2 + bps, ry);           //这是右侧相交点
                if (Math.Abs((trp.Y - tcp.Y) / (trp.X - tcp.X)) > 0.75) //检查,如果找到的倾斜角度超过37度,矫正失败
                {
                    tlp = PhotoTest.NullPoint;
                }
            }

            if (!IsNullPoint(trp) && !IsNullPoint(tlp))
            {
                arc = Convert.ToSingle((Math.Atan((trp.Y - tlp.Y) / (trp.X - tlp.X))));
            }

            if (IsNullPoint(trp))
            {
                arc = Convert.ToSingle((Math.Atan((tcp.Y - tlp.Y) / (tcp.X - tlp.X))));
            }

            if (IsNullPoint(tlp))
            {
                arc = Convert.ToSingle((Math.Atan((trp.Y - tcp.Y) / (trp.X - tcp.X))));
            }

            //cb = RotateBitmap(cb, -arc);
            //mp.CorrectRotatePhoto = WriteableBitmapHelper.Clone(cb);

            double bhs = 0.1 / 39.9;

            bps = Convert.ToInt32(bhs * b.PixelHeight);

            al = getImageGrayHLine(cb, cy - bps); //得到水平像素行

            ral = new List <int>(al);             //克隆水平像素,主要是保留右侧部分
            lal = new List <int>(al);             //克隆水平像素,主要是保留左侧部分
            ral.RemoveRange(0, al.Count / 2 - 1);

            lal.RemoveRange(al.Count / 2 + 1, al.Count / 2 - 1);
            if (al.Count % 2 == 1)
            {
                lal.RemoveAt(lal.Count - 1);
            }
            int lbp, rbp;

            lbp = FindLastWhite(lal, 100);
            rbp = FindFirstWhite(ral, 100);

            bool IsCorrectMoveScale = true;

            if (lbp == -1 && rbp == -1)
            {
                IsCorrectMoveScale = false;
            }
            int SQLength = rbp + al.Count / 2 - lbp;
            int dx, dy;

            dx = (lbp + rbp + al.Count / 2) / 2 - cb.PixelWidth / 2;

            double YISOscale = 20.5 / 39.9;
            int    topy      = Convert.ToInt32(YISOscale * b.PixelHeight);
            int    SQRTop    = cy - SQLength + topy;

            dy = ((cy + topy) * 2 - SQLength) / 2 - b.PixelHeight / 2;

            //cb.Dispose();

            this.MovePosition = new Point(dx, dy);
            this.RotateArc    = arc;

            if (IsCorrectMoveScale)
            {
                ppos = MoveTrans(b, -dx, -dy);
                mp.CorrectMovePhoto = WriteableBitmapHelper.Clone(ppos);
            }
            else
            {
                ppos = b;
            }
            parc = RotateTrans(ppos, -arc);
            mp.CorrectRotatePhoto = WriteableBitmapHelper.Clone(parc);
            if (IsCorrectMoveScale)
            {
                float sd = SQLength / (b.PixelHeight * 0.1002f);
                this.ScaleNum = sd;
                r             = ScaleTrans(parc, 1, 1); //进行缩放匹配
            }
            else
            {
                r = parc;
            }
            mp.CorrectScalePhoto = WriteableBitmapHelper.Clone(r);

            return(r);
        }