コード例 #1
0
        public void OverlaySnapshot(System.Drawing.Bitmap bmp)
        {
            long min_changed_date = DateTime.Now.Ticks - RELEVANT_HISTORY_TICK;

            int minXchanged = int.MaxValue;
            int maxXchanged = 0;
            int minYchanged = int.MaxValue;
            int maxYchanged = 0;



            //Take pixels
            for (int x = 0; x < _xdim; x++)
            {
                for (int y = 0; y < _ydim; y++)
                {
                    if (_values[x, y] > min_changed_date) //Sensor was changed recently
                    {
                        if (x < minXchanged)
                        {
                            minXchanged = x;
                        }
                        if (x > maxXchanged)
                        {
                            maxXchanged = x;
                        }
                        if (y < minYchanged)
                        {
                            minYchanged = y;
                        }
                        if (y > maxYchanged)
                        {
                            maxYchanged = y;
                        }

                        var t = ScaleXY(x, y, bmp);

                        RenderImage.SetMarkerAtPosition(bmp, t.Item1, t.Item2);
                    }
                }
            }

            var minScale = ScaleXY(minXchanged, minYchanged, bmp);
            var maxScale = ScaleXY(maxXchanged, maxYchanged, bmp);


            RenderImage.SetBoundaryRect(bmp, minScale.Item1, minScale.Item2, maxScale.Item1, maxScale.Item2);
        }
コード例 #2
0
        public override async Task <bool> DoWork(WorkItem triggeredWorkItem)
        {
            Logger.Info("Generate the snapshot matrix");
            Bitmap i = RenderImage.BitmapFromBmpByteArray((byte[])triggeredWorkItem.WorkItemContext);

            _thisSnapshot = new SensorSnapshot(SENSOR_HORIZONTAL, SENSOR_VERTICAL);
            _thisSnapshot.TakeSnapshot(i);

            if (_lastSnapshot != null)
            {
                _delta.Update(_lastSnapshot, _thisSnapshot);
            }

            //Do stuff
            _lastSnapshot = _thisSnapshot;
            _thisSnapshot = null;

            return(true);
        }
コード例 #3
0
        private async void CaptureClick_EventHandler(Object sender, EventArgs e)
        {
            Logger.Info("Before write captured screenshot to OneNote");
            //var img = Program.CacheWorker.GenerateTopNImages(2);

            Bitmap imageToWriteBase = (Bitmap)screenCapture.Image;
            Bitmap imageToWrite     = RenderImage.TrimBitmap(imageToWriteBase, _lastMotionRect);



            var capResult = await GenerateSummary.CaptureSummaryToOneNote(imageToWrite);

            if (!capResult.IsSuccess)
            {
                MessageBox.Show(capResult.UserMessage, "Capture Image", MessageBoxButtons.OK);
            }
            else
            {
                this.statusTextBox.Text = capResult.UserMessage;
            }
        }
コード例 #4
0
        public void SetImage(Bitmap img)
        {
            if (Program.CacheWorker.GetCacheMode() == ImageCacheWorker.CacheMode.Capture)
            {
                _lastMotionRect = Program.MotionDetectionWorker.GetMovingRegion(img);
                //Program.MotionDetectionWorker.OverlayDeltaToBitmap(img);
                RenderImage.SetBoundaryRect(img, _lastMotionRect.Left, _lastMotionRect.Top, _lastMotionRect.Right, _lastMotionRect.Bottom);
                //Program.MotionDetectionWorker.OverlayDeltaToBitmap(img);

                if (this.InvokeRequired)
                {
                    InvokeUI(() =>
                    {
                        screenCapture.Image = img;
                    });
                }
                else
                {
                    screenCapture.Image = img;
                }
            }
        }
コード例 #5
0
 private void Render(Bitmap bmp, Rectangle r)
 {
     RenderImage.SetBoundaryRect(bmp, r.Left, r.Top, r.Right, r.Bottom);
     screenCapture.Image = bmp;
 }