Beispiel #1
0
 public MARKER_POS Analysis(Bitmap bmp, ROI roi)
 {
     Rectangle rc = Calib.Convert2Rect(roi);
     int firstMark = CalcuRefPosition(bmp, rc);
     int firstMarkOffset = 60;
     firstMark -= firstMarkOffset;
     int offset = 100;
     Point ptSecondStart = new Point(rc.X, rc.Y + firstMark + offset);
     Size sz = new Size(rc.Width, rc.Height - firstMark - offset);
     Rectangle roi2 = new Rectangle(ptSecondStart, sz);
     int secondMark = CalcuRefPosition(bmp, roi2) + firstMark + offset;
     return new MARKER_POS(firstMark, secondMark);
 }
 public List<ROI> GetVisualROIs(string visualName)
 {
     List<ROI> rois = new List<ROI>();
     List<Point> ptsROI = new List<Point>();
     foreach (MyDrawingVisual visual in Visuals)
     {
         Point pt = new Point(visual.StartPos.X + visual.Offset.X, visual.StartPos.Y + visual.Offset.Y);
         if (visual.Name.IndexOf(visualName) != -1)
         {
             ptsROI.Add(pt);
         }
     }
     for (int i = 0; i < ptsROI.Count; i += 2)
     {
         ROI roi = new ROI(ptsROI[i], ptsROI[i + 1]);
         rois.Add(roi);
     }
     return rois;
 }
Beispiel #3
0
 public static System.Drawing.Rectangle Convert2Rect(ROI roi)
 {
     System.Drawing.Point ptStart = new System.Drawing.Point((int)(roi.ptStart.X / ratioX), (int)(roi.ptStart.Y / ratioY + yShift));
     System.Drawing.Size sz = new System.Drawing.Size((int)((roi.ptEnd.X - roi.ptStart.X) / ratioX), (int)((roi.ptEnd.Y - roi.ptStart.Y) / ratioY));
     return new System.Drawing.Rectangle(ptStart, sz);
 }
Beispiel #4
0
 public unsafe int FindLeftEdge(Bitmap bmp, ROI absoluteROI)
 {
     Rectangle rc = FromAbsROI(absoluteROI);
     int firstMark = CalcuRefPosition(bmp, rc,false);
     return  firstMark;
 }
Beispiel #5
0
 private Rectangle FromAbsROI(ROI roi)
 {
     int width = (int)(roi.ptEnd.X - roi.ptStart.X);
     int height = (int)(roi.ptEnd.Y - roi.ptStart.Y);
     return new Rectangle((int)roi.ptStart.X, (int)roi.ptStart.Y,
         width,height
         );
 }