Exemplo n.º 1
0
        public Pixelmap GetFrame(int frameNo, bool noIntegrate)
        {
            Pixelmap currentBitmap = null;

            if (m_VideoStream != null)
            {
                if (frameNo >= m_VideoStream.LastFrame)
                {
                    frameNo = m_VideoStream.LastFrame;
                }
                if (frameNo < m_VideoStream.FirstFrame)
                {
                    frameNo = m_VideoStream.FirstFrame;
                }

                try
                {
                    if (noIntegrate || !m_VideoStream.SupportsSoftwareIntegration)
                    {
                        currentBitmap = m_VideoStream.GetPixelmap(GetDirectionAwareFrameIndex(frameNo));
                    }
                    else
                    {
                        currentBitmap = m_VideoStream.GetIntegratedFrame(GetDirectionAwareFrameIndex(frameNo), m_FramesToIntegrate,
                                                                         m_FrameIntegration == FrameIntegratingMode.SlidingAverage,
                                                                         m_PixelIntegrationMode == PixelIntegrationType.Median);
                    }
                }
                catch (Exception ex)
                {
                    Trace.WriteLine(ex.ToString());
                }
            }

            return(currentBitmap);
        }
Exemplo n.º 2
0
        public Pixelmap GetPixelmap(int index)
        {
            if (index < FirstFrame)
            {
                index = FirstFrame;
            }
            if (index > LastFrame)
            {
                index = LastFrame;
            }

            uint[] pixels;
            uint[] originalPixels;
            Bitmap videoFrame;

            byte[] bitmapBytes;

            if (Mode == ReInterlaceMode.SwapFields)
            {
                TangraVideo.GetFrame(index, out pixels, out originalPixels, out videoFrame, out bitmapBytes);

                byte[] bitmapPixels = new byte[Width * Height * 3 + 40 + 14 + 1];

                TangraCore.SwapVideoFields(pixels, originalPixels, Width, Height, bitmapPixels, bitmapBytes);

                videoFrame = Pixelmap.ConstructBitmapFromBitmapPixels(bitmapBytes, Width, Height);

                var rv = new Pixelmap(Width, Height, 8, pixels, videoFrame, bitmapBytes);
                rv.UnprocessedPixels = originalPixels;
                return(rv);
            }
            else if (Mode == ReInterlaceMode.ShiftOneField || Mode == ReInterlaceMode.SwapAndShiftOneField)
            {
                uint[] pixels2;
                uint[] originalPixels2;
                Bitmap videoFrame2;
                byte[] bitmapBytes2;

                if (m_LastPrevFrameId == index)
                {
                    pixels         = m_LastPrevFramePixels;
                    originalPixels = m_LastPrevFrameOriginalPixels;
                    bitmapBytes    = m_LastPrevFrameBitmapBytes;
                }
                else
                {
                    TangraVideo.GetFrame(index, out pixels, out originalPixels, out videoFrame, out bitmapBytes);
                }

                TangraVideo.GetFrame(index + 1, out pixels2, out originalPixels2, out videoFrame2, out bitmapBytes2);

                m_LastPrevFrameId             = index + 1;
                m_LastPrevFramePixels         = pixels2;
                m_LastPrevFrameOriginalPixels = originalPixels2;
                m_LastPrevFrameBitmapBytes    = bitmapBytes2;

                byte[] bitmapPixels = new byte[Width * Height * 3 + 40 + 14 + 1];

                TangraCore.ShiftVideoFields(pixels, originalPixels, pixels2, originalPixels2, Width, Height, m_ShiftMode, bitmapPixels, bitmapBytes);

                videoFrame = Pixelmap.ConstructBitmapFromBitmapPixels(bitmapBytes, Width, Height);

                var rv = new Pixelmap(Width, Height, 8, pixels, videoFrame, bitmapBytes);
                rv.UnprocessedPixels = originalPixels;
                return(rv);
            }
            else if (Mode == ReInterlaceMode.None)
            {
                return(m_BaseStream.GetPixelmap(index));
            }
            else
            {
                throw new NotSupportedException();
            }
        }
Exemplo n.º 3
0
        public Pixelmap GetPixelmap(int index)
        {
            Pixelmap image = m_Video.GetPixelmap(index);

            return(RotatePixelMap(image));
        }