コード例 #1
0
        /// <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;
        }
コード例 #2
0
ファイル: FrmMain.cs プロジェクト: evertonschuster/IA
 private void FrmMain_Load(object sender, System.EventArgs e)
 {
     _pictureBoxIpl1 = new PictureBoxIpl
     {
         AutoSize = true
     };
     flowLayoutPanel1.Controls.Add(_pictureBoxIpl1);
 }
コード例 #3
0
 public Renderer()
 {
     pictureBox    = new PictureBoxIpl();
     BoundsChanged = new Subject <Rectangle>();
     InitializeComponent();
     SetSize(new Rectangle(1200, 50, 512, 512));
     Show();
 }
コード例 #4
0
        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;
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
 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();
 }
コード例 #8
0
        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;
        }
コード例 #9
0
        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);
        }
コード例 #10
0
        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();
        }
コード例 #11
0
        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);
                    }
            }
        }