public long getRPResoveLines(WriteableBitmap b, float percent)//最终的通过ISO12233进行测试 { //AutoBright(b); if (percent == 0) { percent = this.ResoveBrightPercent / 100; } if (b == null) { return(0); } WriteableBitmap xb = getAreaRResove(b); if (ProcessInfor.ContainsKey("RayleiResolutionIsLeft")) { ProcessInfor["RayleiResolutionIsLeft"] = false; } else { ProcessInfor.Add("RayleiResolutionIsLeft", false); } long l = getResoveLines(xb, percent, false); return(l); }
//public new void setChart(WriteableBitmap b) //{ // base.setChart(b); // CorrectISO12233Chart(); //} //public void DrawSelectArea(int StartX,int StartY, int w, int h)//在分析照片上面绘制出选择的区域,便于调试 //{ // if (AnalysePhoto == null) // { // if (ChartPhoto == null) { return; } // AnalysePhoto = new WriteableBitmap(ChartPhoto); // } // DrawRecArea(AnalysePhoto, StartX, StartY, w, h, Colors.Red); // mp.SelectedPhoto = new WriteableBitmap(AnalysePhoto); //} public long getLPResoveLines()//自动从原始的照片 { //AutoBright(CorrectPhoto); float percent = this.ResoveBrightPercent / 100; WriteableBitmap xb = getAreaLResove(ChartPhoto); if (ProcessInfor.ContainsKey("RayleiResolutionIsLeft")) { ProcessInfor["RayleiResolutionIsLeft"] = true; } else { ProcessInfor.Add("RayleiResolutionIsLeft", true); } //AutoBright(xb); long l = getResoveLines(xb, percent, true); if (l == 0 || l > 1900)//如果左侧的测试没有测出一个可以的成绩 { //xb.Dispose(); xb = getAreaRResove(ChartPhoto); setProcessInfor("RayleiResolutionIsLeft", false); l = getResoveLines(xb, percent, false); } //xb.Dispose(); return(l); //return getLPResoveLines(CorrectPhoto, 0f); }
public decimal getLPResove(WriteableBitmap b, double Percent)//通过照片得到相机的分辨率,这里是照片是包含逐渐接近的黑白线对的局部,后面是修形的参数 { //算法:第一步找到图像的左边界,和又边界。条件是左边界是白色加黑色,右边界没有则是黑色加灰色 //循环,每一列进行分析。 //SilverlightPhotoIO.PhotoIO.WriteImageToFile(b); long r = getRayleiPosition(b, Percent); if (r == 0) { return(0); } long left, right = 0; left = getLeftPoint(b); right = getRightPoint(b); setProcessInfor("RayleiResolutionLeftBorder", left); setProcessInfor("RayleiResolutionRightBorder", right); decimal x; x = Convert.ToDecimal((r - left)) / Convert.ToDecimal((right - left)); if (ProcessInfor.ContainsKey("RayleiResolutionRightPosition")) { ProcessInfor["RayleiResolutionRightPosition"] = r; } else { ProcessInfor.Add("RayleiResolutionRightPosition", r); } return(x); }