/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Form1_Load(object sender, EventArgs e) { mainBox = new PictureBoxIpl(); tabPage1.Controls.Add(mainBox); mainBox.Dock = DockStyle.Fill; mainDisplay.DoInvalid += delegate { mainBox.Invalidate(false); }; mainDisplay.StatusChange += delegate { ClearAndDraw(); }; //TODO , take as internal handler? ///mouse coordinate not match with image coordinate mainBox.MouseMove += MouseMoveHandler; mainBox.MouseClick += MouseClickHandler; mainBox.MouseDown += MouseDownHandler; mainBox.MouseUp += MouseUpHandler; mainBox.Paint += PaintEventHandler; btnNewLayer.Click += btnNewLayser_Click; btnLine.Click += btnTask_Click; btnSelect.Click += btnTask_Click; loadPicture(@"../../lenna.png"); __isLoaded = true; }
private void FrmMain_Load(object sender, System.EventArgs e) { _pictureBoxIpl1 = new PictureBoxIpl { AutoSize = true }; flowLayoutPanel1.Controls.Add(_pictureBoxIpl1); }
public Renderer() { pictureBox = new PictureBoxIpl(); BoundsChanged = new Subject <Rectangle>(); InitializeComponent(); SetSize(new Rectangle(1200, 50, 512, 512)); Show(); }
public void BoxVsImage(PictureBoxIpl sourceBox, IplImage sourceImage) { var tempx1 = (float)sourceImage.Width; var tempx2 = (float)sourceBox.Width; this.BoxVsImageX = tempx1 / tempx2; var tempy1 = (float)sourceImage.Height; var tempy2 = (float)sourceBox.Height; this.BoxVsImageY = tempy1 / tempy2; }
public PointF ImageToBox(IplImage fromImage, PictureBoxIpl targetBox, PointF fromPoint) { float imgToBox_X = (float)(targetBox.Width / fromImage.Width); float imgToBox_Y = (float)(targetBox.Height / fromImage.Height); float tmpX = (float)(fromPoint.X * imgToBox_X); float tmpY = (float)(fromPoint.Y * imgToBox_Y); PointF targetPoint = new PointF((float)tmpX, (float)tmpY); return(targetPoint); }
public CvPoint ImageToBox(IplImage fromImage, PictureBoxIpl targetBox, CvPoint fromPoint) { double imgToBox_X = (double)targetBox.Width / (double)fromImage.Width; double imgToBox_Y = (double)targetBox.Height / (double)fromImage.Height; double tmpX = (double)fromPoint.X * imgToBox_X; double tmpY = (double)fromPoint.Y * imgToBox_Y; CvPoint targetPoint = new CvPoint((int)tmpX, (int)tmpY); return(targetPoint); }
public Renderer() { pictureBox = new PictureBoxIpl(); BoundsChanged = new Subject <Rectangle>(); InitializeComponent(); SetSize(new Rectangle(1200, 50, 512, 512), true); pictureBox.SizeMode = PictureBoxSizeMode.StretchImage; pictureBox.ClientSize = ClientSize; Show(); sizeDelta = Size - ClientSize; HandleResize(); }
public void BoxVsImage(PictureBoxIpl sourceBox, IplImage sourceImage, ref float[] resultData) { var tempx1 = (float)sourceImage.Width; var tempx2 = (float)sourceBox.Width; this.BoxVsImageX = tempx1 / tempx2; resultData[0] = BoxVsImageX; var tempy1 = (float)sourceImage.Height; var tempy2 = (float)sourceBox.Height; this.BoxVsImageY = tempy1 / tempy2; resultData[1] = BoxVsImageY; }
public List <CvPoint> ImageToBox(IplImage fromImage, PictureBoxIpl targetBox, List <CvPoint> fromPoint) { List <CvPoint> targetPoint = new List <CvPoint>(); double imgToBox_X = (double)targetBox.Width / (double)fromImage.Width; double imgToBox_Y = (double)targetBox.Height / (double)fromImage.Height; for (int i = 0; i < fromPoint.Count(); i++) { double tmpX = (double)fromPoint[i].X * imgToBox_X; double tmpY = (double)fromPoint[i].Y * imgToBox_Y; CvPoint tmPoint = new CvPoint((int)tmpX, (int)tmpY); targetPoint.Add(tmPoint); } return(targetPoint); }
private void MouseDownHandler(object sender, MouseEventArgs e) { PictureBoxIpl __control = (PictureBoxIpl)sender; mainDisplay.HandleMouseDown(sender, e); //!multi selection if (__isMultiSelection) { if (mainDisplay.SelectedObject is SnapBase) { __selectedPoints.Add((SnapBase)mainDisplay.SelectedObject); } } textBoxSelectionCounter.Text = __selectedPoints.Count.ToString(); }
public PictureBoxIplSample() { using (IplImage img = new IplImage(FilePath.Image.Fruits, LoadMode.Color)) { using (Form form = new Form() { ClientSize = new Size(img.Width, img.Height), Text = "PictureBoxIpl Sample" }) using (PictureBoxIpl pbi = new PictureBoxIpl()) { pbi.ImageIpl = img; pbi.ClientSize = form.ClientSize; form.Controls.Add(pbi); Application.Run(form); } } }