AForge.NET

  :: AForge.NET Framework :: Articles :: Forums ::

videoSourcePlayer.GetCurrentVideoFrame() NOT working right

Forum to discuss AForge.NET Framework, its features, API, how-tos, etc.

videoSourcePlayer.GetCurrentVideoFrame() NOT working right

Postby btb4198 » Wed Jan 02, 2019 10:23 pm

The GetCurrentVideoFrame function is NOT working right.

here is a screen shot of my life video steam :
Image

here is a screen shot of a picture box that uses GetCurrentVideoFrame() :

Image

you can clearly see that the two pictures are different, but this should be the same.
here is my code :
Code: Select all
  Bitmap getPic2(int i2)
        {
            Bitmap bmp = null;
            Bitmap tempB = null;
            if (endIRList[i2].X > videoSourcePlayer.Width - 1)
                endIRList[i2]= new System.Drawing.Point(videoSourcePlayer.Width - 1, endIRList[i2].Y);
            if (endIRList[i2].Y > videoSourcePlayer.Height - 1)
                endIRList[i2] = new System.Drawing.Point(endIRList[i2].X, videoSourcePlayer.Height - 1);
            if (stIRList[i2].X >= 0 && stIRList[i2].Y >= 0 && endIRList[i2].X < videoSourcePlayer.Width && endIRList[i2].Y < videoSourcePlayer.Height)
            {
                if (endIRList[i2].X - stIRList[i2].X > 0 && endIRList[i2].Y - stIRList[i2].Y > 0)
                {
                    bmp = videoSourcePlayer.GetCurrentVideoFrame();
                    System.Drawing.Image iOld = p2.Image;
                    tempB = bmp.Clone(new Rectangle(stIRList[i2].X, stIRList[i2].Y, endIRList[i2].X - stIRList[i2].X, endIRList[i2].Y - stIRList[i2].Y),bmp.PixelFormat);

                    if (iOld != null)
                    {
                        iOld.Dispose();
                        iOld = null;
                    }
                }
            }
            pictureBox1.Image = videoSourcePlayer.GetCurrentVideoFrame();

            TestPicBox.Image = tempB;
           

            return tempB;
        }


pictureBox1 is how I am displaying my copy.
anyhow, has anyone seen this before ?

I did make a few changes to Controls.cs to add a zoom and pan function but I never changed videoSourcePlayer.GetCurrentVideoFrame();

also I went back to the old version, the one I downloaded from the site without my changes and it does the same thing.
can anyone help me with this ?
btb4198
 
Posts: 29
Joined: Fri May 18, 2018 2:31 am

Re: videoSourcePlayer.GetCurrentVideoFrame() NOT working rig

Postby btb4198 » Thu Jan 03, 2019 3:59 pm

anyone?

I think it is cutting off part of my picture and I do not know how to fix this.
btb4198
 
Posts: 29
Joined: Fri May 18, 2018 2:31 am

Re: videoSourcePlayer.GetCurrentVideoFrame() NOT working rig

Postby andrew.kirillov » Fri Jan 04, 2019 7:24 am

The GetCurrentVideoFrame() works as expected - it provides image as it came from video source/camera. It does not do any resizing. Check the code. Your control can be of different size though and so the image can be resized before it is displayed. But that is just visual aspect. GetCurrentVideoFrame() is designed and it does return image as from camera.
With best regards,
Andrew


Interested in supporting AForge.NET Framework?
User avatar
andrew.kirillov
Site Admin, AForge.NET Developer
 
Posts: 3363
Joined: Fri Jan 23, 2009 9:12 am
Location: UK




Return to AForge.NET Framework